<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
	.KEYW {color: #933;}
	.COMM {color: #bbb; font-style: italic;}
	.NUMB {color: #393;}
	.STRN {color: #393;}
	.REGX {color: #339;}
	.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
	</style></head><body><pre><span class='line'>  1</span> <span class="COMM">/* crypto-2.1.0.js (c) 2013-2024 Kenji Urushima | kjur.github.io/jsrsasign/license
<span class='line'>  2</span>  */</span><span class="WHIT">
<span class='line'>  3</span> </span><span class="COMM">/*
<span class='line'>  4</span>  * crypto.js - Cryptographic Algorithm Provider class
<span class='line'>  5</span>  *
<span class='line'>  6</span>  * Copyright (c) 2013-2024 Kenji Urushima (kenji.urushima@gmail.com)
<span class='line'>  7</span>  *
<span class='line'>  8</span>  * This software is licensed under the terms of the MIT License.
<span class='line'>  9</span>  * https://kjur.github.io/jsrsasign/license
<span class='line'> 10</span>  *
<span class='line'> 11</span>  * The above copyright and license notice shall be 
<span class='line'> 12</span>  * included in all copies or substantial portions of the Software.
<span class='line'> 13</span>  */</span><span class="WHIT">
<span class='line'> 14</span> 
<span class='line'> 15</span> </span><span class="COMM">/**
<span class='line'> 16</span>  * @fileOverview
<span class='line'> 17</span>  * @name crypto-1.1.js
<span class='line'> 18</span>  * @author Kenji Urushima kenji.urushima@gmail.com
<span class='line'> 19</span>  * @version jsrsasign 11.1.0 crypto 2.1.0 (2024-Feb-01)
<span class='line'> 20</span>  * @since jsrsasign 2.2
<span class='line'> 21</span>  * @license &lt;a href="https://kjur.github.io/jsrsasign/license/">MIT License&lt;/a>
<span class='line'> 22</span>  */</span><span class="WHIT">
<span class='line'> 23</span> 
<span class='line'> 24</span> </span><span class="COMM">/** 
<span class='line'> 25</span>  * kjur's class library name space
<span class='line'> 26</span>  * @name KJUR
<span class='line'> 27</span>  * @namespace kjur's class library name space
<span class='line'> 28</span>  */</span><span class="WHIT">
<span class='line'> 29</span> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">KJUR</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">KJUR</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">KJUR</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 30</span> </span><span class="COMM">/**
<span class='line'> 31</span>  * kjur's cryptographic algorithm provider library name space
<span class='line'> 32</span>  * &lt;p>
<span class='line'> 33</span>  * This namespace privides following crytpgrahic classes.
<span class='line'> 34</span>  * &lt;ul>
<span class='line'> 35</span>  * &lt;li>{@link KJUR.crypto.MessageDigest} - Java JCE(cryptograhic extension) style MessageDigest class&lt;/li>
<span class='line'> 36</span>  * &lt;li>{@link KJUR.crypto.Signature} - Java JCE(cryptograhic extension) style Signature class&lt;/li>
<span class='line'> 37</span>  * &lt;li>{@link KJUR.crypto.Util} - cryptographic utility functions and properties&lt;/li>
<span class='line'> 38</span>  * &lt;/ul>
<span class='line'> 39</span>  * NOTE: Please ignore method summary and document of this namespace. This caused by a bug of jsdoc2.
<span class='line'> 40</span>  * &lt;/p>
<span class='line'> 41</span>  * @name KJUR.crypto
<span class='line'> 42</span>  * @namespace
<span class='line'> 43</span>  */</span><span class="WHIT">
<span class='line'> 44</span> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">KJUR.crypto</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">KJUR.crypto</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">KJUR.crypto</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 45</span> 
<span class='line'> 46</span> </span><span class="COMM">/**
<span class='line'> 47</span>  * static object for cryptographic function utilities
<span class='line'> 48</span>  * @name KJUR.crypto.Util
<span class='line'> 49</span>  * @class static object for cryptographic function utilities
<span class='line'> 50</span>  * @property {Array} DIGESTINFOHEAD PKCS#1 DigestInfo heading hexadecimal bytes for each hash algorithms
<span class='line'> 51</span>  * @property {Array} DEFAULTPROVIDER associative array of default provider name for each hash and signature algorithms
<span class='line'> 52</span>  * @description
<span class='line'> 53</span>  */</span><span class="WHIT">
<span class='line'> 54</span> </span><span class="NAME">KJUR.crypto.Util</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 55</span> </span><span class="WHIT">    </span><span class="NAME">this.DIGESTINFOHEAD</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 56</span> </span><span class="WHIT">	</span><span class="STRN">'sha1'</span><span class="PUNC">:</span><span class="WHIT">      </span><span class="STRN">"3021300906052b0e03021a05000414"</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 57</span> </span><span class="WHIT">        </span><span class="STRN">'sha224'</span><span class="PUNC">:</span><span class="WHIT">    </span><span class="STRN">"302d300d06096086480165030402040500041c"</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 58</span> </span><span class="WHIT">	</span><span class="STRN">'sha256'</span><span class="PUNC">:</span><span class="WHIT">    </span><span class="STRN">"3031300d060960864801650304020105000420"</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 59</span> </span><span class="WHIT">	</span><span class="STRN">'sha384'</span><span class="PUNC">:</span><span class="WHIT">    </span><span class="STRN">"3041300d060960864801650304020205000430"</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 60</span> </span><span class="WHIT">	</span><span class="STRN">'sha512'</span><span class="PUNC">:</span><span class="WHIT">    </span><span class="STRN">"3051300d060960864801650304020305000440"</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 61</span> </span><span class="WHIT">	</span><span class="STRN">'md2'</span><span class="PUNC">:</span><span class="WHIT">       </span><span class="STRN">"3020300c06082a864886f70d020205000410"</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 62</span> </span><span class="WHIT">	</span><span class="STRN">'md5'</span><span class="PUNC">:</span><span class="WHIT">       </span><span class="STRN">"3020300c06082a864886f70d020505000410"</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 63</span> </span><span class="WHIT">	</span><span class="STRN">'ripemd160'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"3021300906052b2403020105000414"</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 64</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 65</span> 
<span class='line'> 66</span> </span><span class="WHIT">    </span><span class="COMM">/*
<span class='line'> 67</span>      * @since crypto 1.1.1
<span class='line'> 68</span>      */</span><span class="WHIT">
<span class='line'> 69</span> </span><span class="WHIT">    </span><span class="NAME">this.DEFAULTPROVIDER</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 70</span> </span><span class="WHIT">	</span><span class="STRN">'md5'</span><span class="PUNC">:</span><span class="WHIT">			</span><span class="STRN">'cryptojs'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 71</span> </span><span class="WHIT">	</span><span class="STRN">'sha1'</span><span class="PUNC">:</span><span class="WHIT">			</span><span class="STRN">'cryptojs'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 72</span> </span><span class="WHIT">	</span><span class="STRN">'sha224'</span><span class="PUNC">:</span><span class="WHIT">		</span><span class="STRN">'cryptojs'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 73</span> </span><span class="WHIT">	</span><span class="STRN">'sha256'</span><span class="PUNC">:</span><span class="WHIT">		</span><span class="STRN">'cryptojs'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 74</span> </span><span class="WHIT">	</span><span class="STRN">'sha384'</span><span class="PUNC">:</span><span class="WHIT">		</span><span class="STRN">'cryptojs'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 75</span> </span><span class="WHIT">	</span><span class="STRN">'sha512'</span><span class="PUNC">:</span><span class="WHIT">		</span><span class="STRN">'cryptojs'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 76</span> </span><span class="WHIT">	</span><span class="STRN">'ripemd160'</span><span class="PUNC">:</span><span class="WHIT">		</span><span class="STRN">'cryptojs'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 77</span> </span><span class="WHIT">	</span><span class="STRN">'hmacmd5'</span><span class="PUNC">:</span><span class="WHIT">		</span><span class="STRN">'cryptojs'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 78</span> </span><span class="WHIT">	</span><span class="STRN">'hmacsha1'</span><span class="PUNC">:</span><span class="WHIT">		</span><span class="STRN">'cryptojs'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 79</span> </span><span class="WHIT">	</span><span class="STRN">'hmacsha224'</span><span class="PUNC">:</span><span class="WHIT">		</span><span class="STRN">'cryptojs'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 80</span> </span><span class="WHIT">	</span><span class="STRN">'hmacsha256'</span><span class="PUNC">:</span><span class="WHIT">		</span><span class="STRN">'cryptojs'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 81</span> </span><span class="WHIT">	</span><span class="STRN">'hmacsha384'</span><span class="PUNC">:</span><span class="WHIT">		</span><span class="STRN">'cryptojs'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 82</span> </span><span class="WHIT">	</span><span class="STRN">'hmacsha512'</span><span class="PUNC">:</span><span class="WHIT">		</span><span class="STRN">'cryptojs'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 83</span> </span><span class="WHIT">	</span><span class="STRN">'hmacripemd160'</span><span class="PUNC">:</span><span class="WHIT">	</span><span class="STRN">'cryptojs'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 84</span> 
<span class='line'> 85</span> </span><span class="WHIT">	</span><span class="STRN">'MD5withRSA'</span><span class="PUNC">:</span><span class="WHIT">		</span><span class="STRN">'cryptojs/jsrsa'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 86</span> </span><span class="WHIT">	</span><span class="STRN">'SHA1withRSA'</span><span class="PUNC">:</span><span class="WHIT">		</span><span class="STRN">'cryptojs/jsrsa'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 87</span> </span><span class="WHIT">	</span><span class="STRN">'SHA224withRSA'</span><span class="PUNC">:</span><span class="WHIT">	</span><span class="STRN">'cryptojs/jsrsa'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 88</span> </span><span class="WHIT">	</span><span class="STRN">'SHA256withRSA'</span><span class="PUNC">:</span><span class="WHIT">	</span><span class="STRN">'cryptojs/jsrsa'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 89</span> </span><span class="WHIT">	</span><span class="STRN">'SHA384withRSA'</span><span class="PUNC">:</span><span class="WHIT">	</span><span class="STRN">'cryptojs/jsrsa'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 90</span> </span><span class="WHIT">	</span><span class="STRN">'SHA512withRSA'</span><span class="PUNC">:</span><span class="WHIT">	</span><span class="STRN">'cryptojs/jsrsa'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 91</span> </span><span class="WHIT">	</span><span class="STRN">'RIPEMD160withRSA'</span><span class="PUNC">:</span><span class="WHIT">	</span><span class="STRN">'cryptojs/jsrsa'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 92</span> 
<span class='line'> 93</span> </span><span class="WHIT">	</span><span class="STRN">'MD5withECDSA'</span><span class="PUNC">:</span><span class="WHIT">		</span><span class="STRN">'cryptojs/jsrsa'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 94</span> </span><span class="WHIT">	</span><span class="STRN">'SHA1withECDSA'</span><span class="PUNC">:</span><span class="WHIT">	</span><span class="STRN">'cryptojs/jsrsa'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 95</span> </span><span class="WHIT">	</span><span class="STRN">'SHA224withECDSA'</span><span class="PUNC">:</span><span class="WHIT">	</span><span class="STRN">'cryptojs/jsrsa'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 96</span> </span><span class="WHIT">	</span><span class="STRN">'SHA256withECDSA'</span><span class="PUNC">:</span><span class="WHIT">	</span><span class="STRN">'cryptojs/jsrsa'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 97</span> </span><span class="WHIT">	</span><span class="STRN">'SHA384withECDSA'</span><span class="PUNC">:</span><span class="WHIT">	</span><span class="STRN">'cryptojs/jsrsa'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 98</span> </span><span class="WHIT">	</span><span class="STRN">'SHA512withECDSA'</span><span class="PUNC">:</span><span class="WHIT">	</span><span class="STRN">'cryptojs/jsrsa'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 99</span> </span><span class="WHIT">	</span><span class="STRN">'RIPEMD160withECDSA'</span><span class="PUNC">:</span><span class="WHIT">	</span><span class="STRN">'cryptojs/jsrsa'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>100</span> 
<span class='line'>101</span> </span><span class="WHIT">	</span><span class="STRN">'SHA1withDSA'</span><span class="PUNC">:</span><span class="WHIT">		</span><span class="STRN">'cryptojs/jsrsa'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>102</span> </span><span class="WHIT">	</span><span class="STRN">'SHA224withDSA'</span><span class="PUNC">:</span><span class="WHIT">	</span><span class="STRN">'cryptojs/jsrsa'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>103</span> </span><span class="WHIT">	</span><span class="STRN">'SHA256withDSA'</span><span class="PUNC">:</span><span class="WHIT">	</span><span class="STRN">'cryptojs/jsrsa'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>104</span> 
<span class='line'>105</span> </span><span class="WHIT">	</span><span class="STRN">'MD5withRSAandMGF1'</span><span class="PUNC">:</span><span class="WHIT">		</span><span class="STRN">'cryptojs/jsrsa'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>106</span> </span><span class="WHIT">	</span><span class="STRN">'SHAwithRSAandMGF1'</span><span class="PUNC">:</span><span class="WHIT">		</span><span class="STRN">'cryptojs/jsrsa'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>107</span> </span><span class="WHIT">	</span><span class="STRN">'SHA1withRSAandMGF1'</span><span class="PUNC">:</span><span class="WHIT">		</span><span class="STRN">'cryptojs/jsrsa'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>108</span> </span><span class="WHIT">	</span><span class="STRN">'SHA224withRSAandMGF1'</span><span class="PUNC">:</span><span class="WHIT">		</span><span class="STRN">'cryptojs/jsrsa'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>109</span> </span><span class="WHIT">	</span><span class="STRN">'SHA256withRSAandMGF1'</span><span class="PUNC">:</span><span class="WHIT">		</span><span class="STRN">'cryptojs/jsrsa'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>110</span> </span><span class="WHIT">	</span><span class="STRN">'SHA384withRSAandMGF1'</span><span class="PUNC">:</span><span class="WHIT">		</span><span class="STRN">'cryptojs/jsrsa'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>111</span> </span><span class="WHIT">	</span><span class="STRN">'SHA512withRSAandMGF1'</span><span class="PUNC">:</span><span class="WHIT">		</span><span class="STRN">'cryptojs/jsrsa'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>112</span> </span><span class="WHIT">	</span><span class="STRN">'RIPEMD160withRSAandMGF1'</span><span class="PUNC">:</span><span class="WHIT">	</span><span class="STRN">'cryptojs/jsrsa'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>113</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>114</span> 
<span class='line'>115</span> </span><span class="WHIT">    </span><span class="COMM">/*
<span class='line'>116</span>      * @since crypto 1.1.2
<span class='line'>117</span>      */</span><span class="WHIT">
<span class='line'>118</span> </span><span class="WHIT">    </span><span class="NAME">this.CRYPTOJSMESSAGEDIGESTNAME</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>119</span> </span><span class="WHIT">	</span><span class="STRN">'md5'</span><span class="PUNC">:</span><span class="WHIT">		</span><span class="NAME">CryptoJS.algo.MD5</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>120</span> </span><span class="WHIT">	</span><span class="STRN">'sha1'</span><span class="PUNC">:</span><span class="WHIT">		</span><span class="NAME">CryptoJS.algo.SHA1</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>121</span> </span><span class="WHIT">	</span><span class="STRN">'sha224'</span><span class="PUNC">:</span><span class="WHIT">	</span><span class="NAME">CryptoJS.algo.SHA224</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>122</span> </span><span class="WHIT">	</span><span class="STRN">'sha256'</span><span class="PUNC">:</span><span class="WHIT">	</span><span class="NAME">CryptoJS.algo.SHA256</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>123</span> </span><span class="WHIT">	</span><span class="STRN">'sha384'</span><span class="PUNC">:</span><span class="WHIT">	</span><span class="NAME">CryptoJS.algo.SHA384</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>124</span> </span><span class="WHIT">	</span><span class="STRN">'sha512'</span><span class="PUNC">:</span><span class="WHIT">	</span><span class="NAME">CryptoJS.algo.SHA512</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>125</span> </span><span class="WHIT">	</span><span class="STRN">'ripemd160'</span><span class="PUNC">:</span><span class="WHIT">	</span><span class="NAME">CryptoJS.algo.RIPEMD160</span><span class="WHIT">
<span class='line'>126</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>127</span> 
<span class='line'>128</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>129</span>      * get hexadecimal DigestInfo
<span class='line'>130</span>      * @name getDigestInfoHex
<span class='line'>131</span>      * @memberOf KJUR.crypto.Util
<span class='line'>132</span>      * @function
<span class='line'>133</span>      * @param {String} hHash hexadecimal hash value
<span class='line'>134</span>      * @param {String} alg hash algorithm name (ex. 'sha1')
<span class='line'>135</span>      * @return {String} hexadecimal string DigestInfo ASN.1 structure
<span class='line'>136</span>      */</span><span class="WHIT">
<span class='line'>137</span> </span><span class="WHIT">    </span><span class="NAME">this.getDigestInfoHex</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">hHash</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">alg</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>138</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">this.DIGESTINFOHEAD</span><span class="PUNC">[</span><span class="NAME">alg</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>139</span> </span><span class="WHIT">	    </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"alg not supported in Util.DIGESTINFOHEAD: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">alg</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>140</span> </span><span class="WHIT">	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.DIGESTINFOHEAD</span><span class="PUNC">[</span><span class="NAME">alg</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">hHash</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>141</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>142</span> 
<span class='line'>143</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>144</span>      * get PKCS#1 padded hexadecimal DigestInfo
<span class='line'>145</span>      * @name getPaddedDigestInfoHex
<span class='line'>146</span>      * @memberOf KJUR.crypto.Util
<span class='line'>147</span>      * @function
<span class='line'>148</span>      * @param {String} hHash hexadecimal hash value of message to be signed
<span class='line'>149</span>      * @param {String} alg hash algorithm name (ex. 'sha1')
<span class='line'>150</span>      * @param {Integer} keySize key bit length (ex. 1024)
<span class='line'>151</span>      * @return {String} hexadecimal string of PKCS#1 padded DigestInfo
<span class='line'>152</span>      */</span><span class="WHIT">
<span class='line'>153</span> </span><span class="WHIT">    </span><span class="NAME">this.getPaddedDigestInfoHex</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">hHash</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">alg</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">keySize</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>154</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">hDigestInfo</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.getDigestInfoHex</span><span class="PUNC">(</span><span class="NAME">hHash</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">alg</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>155</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">pmStrLen</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">keySize</span><span class="WHIT"> </span><span class="PUNC">/</span><span class="WHIT"> </span><span class="NUMB">4</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">// minimum PM length</span><span class="WHIT">
<span class='line'>156</span> 
<span class='line'>157</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">hDigestInfo.length</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NUMB">22</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NAME">pmStrLen</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="COMM">// len(0001+ff(*8)+00+hDigestInfo)=22</span><span class="WHIT">
<span class='line'>158</span> </span><span class="WHIT">	    </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"key is too short for SigAlg: keylen="</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">keySize</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">","</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">alg</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>159</span> 
<span class='line'>160</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">hHead</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"0001"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>161</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">hTail</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"00"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">hDigestInfo</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>162</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">hMid</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>163</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">fLen</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">pmStrLen</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">hHead.length</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">hTail.length</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>164</span> </span><span class="WHIT">	</span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">fLen</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">2</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>165</span> </span><span class="WHIT">	    </span><span class="NAME">hMid</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"ff"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>166</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>167</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">hPaddedMessage</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">hHead</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">hMid</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">hTail</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>168</span> </span><span class="WHIT">	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">hPaddedMessage</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>169</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>170</span> 
<span class='line'>171</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>172</span>      * get hexadecimal hash of string with specified algorithm
<span class='line'>173</span>      * @name hashString
<span class='line'>174</span>      * @memberOf KJUR.crypto.Util
<span class='line'>175</span>      * @function
<span class='line'>176</span>      * @param {String} s raw input string to be hashed
<span class='line'>177</span>      * @param {String} alg hash algorithm name
<span class='line'>178</span>      * @return {String} hexadecimal string of hash value
<span class='line'>179</span>      * @since 1.1.1
<span class='line'>180</span>      */</span><span class="WHIT">
<span class='line'>181</span> </span><span class="WHIT">    </span><span class="NAME">this.hashString</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">alg</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>182</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">md</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">KJUR.crypto.MessageDigest</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="STRN">'alg'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">alg</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>183</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">md.digestString</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>184</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>185</span> 
<span class='line'>186</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>187</span>      * get hexadecimal hash of hexadecimal string with specified algorithm
<span class='line'>188</span>      * @name hashHex
<span class='line'>189</span>      * @memberOf KJUR.crypto.Util
<span class='line'>190</span>      * @function
<span class='line'>191</span>      * @param {String} sHex input hexadecimal string to be hashed
<span class='line'>192</span>      * @param {String} alg hash algorithm name
<span class='line'>193</span>      * @return {String} hexadecimal string of hash value
<span class='line'>194</span>      * @since 1.1.1
<span class='line'>195</span>      */</span><span class="WHIT">
<span class='line'>196</span> </span><span class="WHIT">    </span><span class="NAME">this.hashHex</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">sHex</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">alg</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>197</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">md</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">KJUR.crypto.MessageDigest</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="STRN">'alg'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">alg</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>198</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">md.digestHex</span><span class="PUNC">(</span><span class="NAME">sHex</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>199</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>200</span> 
<span class='line'>201</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>202</span>      * get hexadecimal SHA1 hash of string
<span class='line'>203</span>      * @name sha1
<span class='line'>204</span>      * @memberOf KJUR.crypto.Util
<span class='line'>205</span>      * @function
<span class='line'>206</span>      * @param {String} s raw input string to be hashed
<span class='line'>207</span>      * @return {String} hexadecimal string of hash value
<span class='line'>208</span>      * @since 1.0.3
<span class='line'>209</span>      */</span><span class="WHIT">
<span class='line'>210</span> </span><span class="WHIT">    </span><span class="NAME">this.sha1</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>211</span> </span><span class="WHIT">	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.hashString</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'sha1'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>212</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>213</span> 
<span class='line'>214</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>215</span>      * get hexadecimal SHA256 hash of string
<span class='line'>216</span>      * @name sha256
<span class='line'>217</span>      * @memberOf KJUR.crypto.Util
<span class='line'>218</span>      * @function
<span class='line'>219</span>      * @param {String} s raw input string to be hashed
<span class='line'>220</span>      * @return {String} hexadecimal string of hash value
<span class='line'>221</span>      * @since 1.0.3
<span class='line'>222</span>      */</span><span class="WHIT">
<span class='line'>223</span> </span><span class="WHIT">    </span><span class="NAME">this.sha256</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>224</span> </span><span class="WHIT">	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.hashString</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'sha256'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>225</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>226</span> 
<span class='line'>227</span> </span><span class="WHIT">    </span><span class="NAME">this.sha256Hex</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>228</span> </span><span class="WHIT">	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.hashHex</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'sha256'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>229</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>230</span> 
<span class='line'>231</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>232</span>      * get hexadecimal SHA512 hash of string
<span class='line'>233</span>      * @name sha512
<span class='line'>234</span>      * @memberOf KJUR.crypto.Util
<span class='line'>235</span>      * @function
<span class='line'>236</span>      * @param {String} s raw input string to be hashed
<span class='line'>237</span>      * @return {String} hexadecimal string of hash value
<span class='line'>238</span>      * @since 1.0.3
<span class='line'>239</span>      */</span><span class="WHIT">
<span class='line'>240</span> </span><span class="WHIT">    </span><span class="NAME">this.sha512</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>241</span> </span><span class="WHIT">	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.hashString</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'sha512'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>242</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>243</span> 
<span class='line'>244</span> </span><span class="WHIT">    </span><span class="NAME">this.sha512Hex</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>245</span> </span><span class="WHIT">	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.hashHex</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'sha512'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>246</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>247</span> 
<span class='line'>248</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>249</span>      * check if key object (RSA/DSA/ECDSA) or not
<span class='line'>250</span>      * @name isKey
<span class='line'>251</span>      * @memberOf KJUR.crypto.Util
<span class='line'>252</span>      * @function
<span class='line'>253</span>      * @param {Object} obj any type argument to be checked
<span class='line'>254</span>      * @return {Boolean} true if this is key object otherwise false
<span class='line'>255</span>      * @since 1.0.3
<span class='line'>256</span>      */</span><span class="WHIT">
<span class='line'>257</span> </span><span class="WHIT">    </span><span class="NAME">this.isKey</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">obj</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>258</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">obj</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">RSAKey</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT">
<span class='line'>259</span> </span><span class="WHIT">	    </span><span class="NAME">obj</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">KJUR.crypto.DSA</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT">
<span class='line'>260</span> </span><span class="WHIT">	    </span><span class="NAME">obj</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">KJUR.crypto.ECDSA</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>261</span> </span><span class="WHIT">	    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>262</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>263</span> </span><span class="WHIT">	    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>264</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>265</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>266</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>267</span> 
<span class='line'>268</span> </span><span class="COMM">/**
<span class='line'>269</span>  * get hexadecimal MD5 hash of string
<span class='line'>270</span>  * @name md5
<span class='line'>271</span>  * @memberOf KJUR.crypto.Util
<span class='line'>272</span>  * @function
<span class='line'>273</span>  * @param {String} s input string to be hashed
<span class='line'>274</span>  * @return {String} hexadecimal string of hash value
<span class='line'>275</span>  * @since 1.0.3
<span class='line'>276</span>  * @example
<span class='line'>277</span>  * Util.md5('aaa') &rarr; 47bce5c74f589f4867dbd57e9ca9f808
<span class='line'>278</span>  */</span><span class="WHIT">
<span class='line'>279</span> </span><span class="NAME">KJUR.crypto.Util.md5</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>280</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">md</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">KJUR.crypto.MessageDigest</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="STRN">'alg'</span><span class="PUNC">:</span><span class="STRN">'md5'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'prov'</span><span class="PUNC">:</span><span class="STRN">'cryptojs'</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>281</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">md.digestString</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>282</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>283</span> 
<span class='line'>284</span> </span><span class="COMM">/**
<span class='line'>285</span>  * get hexadecimal RIPEMD160 hash of string
<span class='line'>286</span>  * @name ripemd160
<span class='line'>287</span>  * @memberOf KJUR.crypto.Util
<span class='line'>288</span>  * @function
<span class='line'>289</span>  * @param {String} s input string to be hashed
<span class='line'>290</span>  * @return {String} hexadecimal string of hash value
<span class='line'>291</span>  * @since 1.0.3
<span class='line'>292</span>  * @example
<span class='line'>293</span>  * KJUR.crypto.Util.ripemd160("aaa") &rarr; 08889bd7b151aa174c21f33f59147fa65381edea
<span class='line'>294</span>  */</span><span class="WHIT">
<span class='line'>295</span> </span><span class="NAME">KJUR.crypto.Util.ripemd160</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>296</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">md</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">KJUR.crypto.MessageDigest</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="STRN">'alg'</span><span class="PUNC">:</span><span class="STRN">'ripemd160'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'prov'</span><span class="PUNC">:</span><span class="STRN">'cryptojs'</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>297</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">md.digestString</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>298</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>299</span> 
<span class='line'>300</span> </span><span class="COMM">// @since jsrsasign 7.0.0 crypto 1.1.11</span><span class="WHIT">
<span class='line'>301</span> </span><span class="NAME">KJUR.crypto.Util.SECURERANDOMGEN</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">SecureRandom</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>302</span> 
<span class='line'>303</span> </span><span class="COMM">/**
<span class='line'>304</span>  * get hexadecimal string of random value from with specified byte length&lt;br/>
<span class='line'>305</span>  * @name getRandomHexOfNbytes
<span class='line'>306</span>  * @memberOf KJUR.crypto.Util
<span class='line'>307</span>  * @function
<span class='line'>308</span>  * @param {Integer} n length of bytes of random
<span class='line'>309</span>  * @return {String} hexadecimal string of random
<span class='line'>310</span>  * @since jsrsasign 7.0.0 crypto 1.1.11
<span class='line'>311</span>  * @example
<span class='line'>312</span>  * KJUR.crypto.Util.getRandomHexOfNbytes(3) &rarr; "6314af", "000000" or "001fb4"
<span class='line'>313</span>  * KJUR.crypto.Util.getRandomHexOfNbytes(128) &rarr; "8fbc..." in 1024bits 
<span class='line'>314</span>  */</span><span class="WHIT">
<span class='line'>315</span> </span><span class="NAME">KJUR.crypto.Util.getRandomHexOfNbytes</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">n</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>316</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">ba</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">(</span><span class="NAME">n</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>317</span> </span><span class="WHIT">    </span><span class="NAME">KJUR.crypto.Util.SECURERANDOMGEN.nextBytes</span><span class="PUNC">(</span><span class="NAME">ba</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>318</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">BAtohex</span><span class="PUNC">(</span><span class="NAME">ba</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>319</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>320</span> 
<span class='line'>321</span> </span><span class="COMM">/**
<span class='line'>322</span>  * get BigInteger object of random value from with specified byte length&lt;br/>
<span class='line'>323</span>  * @name getRandomBigIntegerOfNbytes
<span class='line'>324</span>  * @memberOf KJUR.crypto.Util
<span class='line'>325</span>  * @function
<span class='line'>326</span>  * @param {Integer} n length of bytes of random
<span class='line'>327</span>  * @return {BigInteger} BigInteger object of specified random value
<span class='line'>328</span>  * @since jsrsasign 7.0.0 crypto 1.1.11
<span class='line'>329</span>  * @example
<span class='line'>330</span>  * KJUR.crypto.Util.getRandomBigIntegerOfNbytes(3) &rarr; 6314af of BigInteger
<span class='line'>331</span>  * KJUR.crypto.Util.getRandomBigIntegerOfNbytes(128) &rarr; 8fbc... of BigInteger
<span class='line'>332</span>  */</span><span class="WHIT">
<span class='line'>333</span> </span><span class="NAME">KJUR.crypto.Util.getRandomBigIntegerOfNbytes</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">n</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>334</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">BigInteger</span><span class="PUNC">(</span><span class="NAME">KJUR.crypto.Util.getRandomHexOfNbytes</span><span class="PUNC">(</span><span class="NAME">n</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">16</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>335</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>336</span> 
<span class='line'>337</span> </span><span class="COMM">/**
<span class='line'>338</span>  * get hexadecimal string of random value from with specified bit length&lt;br/>
<span class='line'>339</span>  * @name getRandomHexOfNbits
<span class='line'>340</span>  * @memberOf KJUR.crypto.Util
<span class='line'>341</span>  * @function
<span class='line'>342</span>  * @param {Integer} n length of bits of random
<span class='line'>343</span>  * @return {String} hexadecimal string of random
<span class='line'>344</span>  * @since jsrsasign 7.0.0 crypto 1.1.11
<span class='line'>345</span>  * @example
<span class='line'>346</span>  * KJUR.crypto.Util.getRandomHexOfNbits(24) &rarr; "6314af", "000000" or "001fb4"
<span class='line'>347</span>  * KJUR.crypto.Util.getRandomHexOfNbits(1024) &rarr; "8fbc..." in 1024bits 
<span class='line'>348</span>  */</span><span class="WHIT">
<span class='line'>349</span> </span><span class="NAME">KJUR.crypto.Util.getRandomHexOfNbits</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">n</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>350</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">n_remainder</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">%</span><span class="WHIT"> </span><span class="NUMB">8</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>351</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">n_quotient</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">n_remainder</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">/</span><span class="WHIT"> </span><span class="NUMB">8</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>352</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">ba</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">(</span><span class="NAME">n_quotient</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>353</span> </span><span class="WHIT">    </span><span class="NAME">KJUR.crypto.Util.SECURERANDOMGEN.nextBytes</span><span class="PUNC">(</span><span class="NAME">ba</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>354</span> </span><span class="WHIT">    </span><span class="NAME">ba</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NUMB">255</span><span class="WHIT"> </span><span class="PUNC">&lt;&lt;</span><span class="WHIT"> </span><span class="NAME">n_remainder</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&</span><span class="WHIT"> </span><span class="NUMB">255</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">^</span><span class="WHIT"> </span><span class="NUMB">255</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&</span><span class="WHIT"> </span><span class="NAME">ba</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>355</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">BAtohex</span><span class="PUNC">(</span><span class="NAME">ba</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>356</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>357</span> 
<span class='line'>358</span> </span><span class="COMM">/**
<span class='line'>359</span>  * get BigInteger object of random value from with specified bit length&lt;br/>
<span class='line'>360</span>  * @name getRandomBigIntegerOfNbits
<span class='line'>361</span>  * @memberOf KJUR.crypto.Util
<span class='line'>362</span>  * @function
<span class='line'>363</span>  * @param {Integer} n length of bits of random
<span class='line'>364</span>  * @return {BigInteger} BigInteger object of specified random value
<span class='line'>365</span>  * @since jsrsasign 7.0.0 crypto 1.1.11
<span class='line'>366</span>  * @example
<span class='line'>367</span>  * KJUR.crypto.Util.getRandomBigIntegerOfNbits(24) &rarr; 6314af of BigInteger
<span class='line'>368</span>  * KJUR.crypto.Util.getRandomBigIntegerOfNbits(1024) &rarr; 8fbc... of BigInteger
<span class='line'>369</span>  */</span><span class="WHIT">
<span class='line'>370</span> </span><span class="NAME">KJUR.crypto.Util.getRandomBigIntegerOfNbits</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">n</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>371</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">BigInteger</span><span class="PUNC">(</span><span class="NAME">KJUR.crypto.Util.getRandomHexOfNbits</span><span class="PUNC">(</span><span class="NAME">n</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">16</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>372</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>373</span> 
<span class='line'>374</span> </span><span class="COMM">/**
<span class='line'>375</span>  * get BigInteger object of random value from zero to max value&lt;br/>
<span class='line'>376</span>  * @name getRandomBigIntegerZeroToMax
<span class='line'>377</span>  * @memberOf KJUR.crypto.Util
<span class='line'>378</span>  * @function
<span class='line'>379</span>  * @param {BigInteger} biMax max value of BigInteger object for random value
<span class='line'>380</span>  * @return {BigInteger} BigInteger object of specified random value
<span class='line'>381</span>  * @since jsrsasign 7.0.0 crypto 1.1.11
<span class='line'>382</span>  * @description
<span class='line'>383</span>  * This static method generates a BigInteger object with random value
<span class='line'>384</span>  * greater than or equal to zero and smaller than or equal to biMax
<span class='line'>385</span>  * (i.e. 0 &le; result &le; biMax).
<span class='line'>386</span>  * @example
<span class='line'>387</span>  * biMax = new BigInteger("3fa411...", 16);
<span class='line'>388</span>  * KJUR.crypto.Util.getRandomBigIntegerZeroToMax(biMax) &rarr; 8fbc... of BigInteger
<span class='line'>389</span>  */</span><span class="WHIT">
<span class='line'>390</span> </span><span class="NAME">KJUR.crypto.Util.getRandomBigIntegerZeroToMax</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">biMax</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>391</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">bitLenMax</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">biMax.bitLength</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>392</span> </span><span class="WHIT">    </span><span class="KEYW">while</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>393</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">biRand</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">KJUR.crypto.Util.getRandomBigIntegerOfNbits</span><span class="PUNC">(</span><span class="NAME">bitLenMax</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>394</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">biMax.compareTo</span><span class="PUNC">(</span><span class="NAME">biRand</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">biRand</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>395</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>396</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>397</span> 
<span class='line'>398</span> </span><span class="COMM">/**
<span class='line'>399</span>  * get BigInteger object of random value from min value to max value&lt;br/>
<span class='line'>400</span>  * @name getRandomBigIntegerMinToMax
<span class='line'>401</span>  * @memberOf KJUR.crypto.Util
<span class='line'>402</span>  * @function
<span class='line'>403</span>  * @param {BigInteger} biMin min value of BigInteger object for random value
<span class='line'>404</span>  * @param {BigInteger} biMax max value of BigInteger object for random value
<span class='line'>405</span>  * @return {BigInteger} BigInteger object of specified random value
<span class='line'>406</span>  * @since jsrsasign 7.0.0 crypto 1.1.11
<span class='line'>407</span>  * @description
<span class='line'>408</span>  * This static method generates a BigInteger object with random value
<span class='line'>409</span>  * greater than or equal to biMin and smaller than or equal to biMax
<span class='line'>410</span>  * (i.e. biMin &le; result &le; biMax).
<span class='line'>411</span>  * @example
<span class='line'>412</span>  * biMin = new BigInteger("2fa411...", 16);
<span class='line'>413</span>  * biMax = new BigInteger("3fa411...", 16);
<span class='line'>414</span>  * KJUR.crypto.Util.getRandomBigIntegerMinToMax(biMin, biMax) &rarr; 32f1... of BigInteger
<span class='line'>415</span>  */</span><span class="WHIT">
<span class='line'>416</span> </span><span class="NAME">KJUR.crypto.Util.getRandomBigIntegerMinToMax</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">biMin</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">biMax</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>417</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">flagCompare</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">biMin.compareTo</span><span class="PUNC">(</span><span class="NAME">biMax</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>418</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">flagCompare</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"biMin is greater than biMax"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>419</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">flagCompare</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">biMin</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>420</span> 
<span class='line'>421</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">biDiff</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">biMax.subtract</span><span class="PUNC">(</span><span class="NAME">biMin</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>422</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">biRand</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">KJUR.crypto.Util.getRandomBigIntegerZeroToMax</span><span class="PUNC">(</span><span class="NAME">biDiff</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>423</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">biRand.add</span><span class="PUNC">(</span><span class="NAME">biMin</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>424</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>425</span> 
<span class='line'>426</span> </span><span class="COMM">// === Mac ===============================================================</span><span class="WHIT">
<span class='line'>427</span> 
<span class='line'>428</span> </span><span class="COMM">/**
<span class='line'>429</span>  * MessageDigest class which is very similar to java.security.MessageDigest class&lt;br/>
<span class='line'>430</span>  * @name KJUR.crypto.MessageDigest
<span class='line'>431</span>  * @class MessageDigest class which is very similar to java.security.MessageDigest class
<span class='line'>432</span>  * @param {Array} params parameters for constructor
<span class='line'>433</span>  * @property {Array} HASHLENGTH static Array of resulted byte length of hash (ex. HASHLENGTH["sha1"] == 20)
<span class='line'>434</span>  * @description
<span class='line'>435</span>  * &lt;br/>
<span class='line'>436</span>  * Currently this supports following algorithm and providers combination:
<span class='line'>437</span>  * &lt;ul>
<span class='line'>438</span>  * &lt;li>md5 - cryptojs&lt;/li>
<span class='line'>439</span>  * &lt;li>sha1 - cryptojs&lt;/li>
<span class='line'>440</span>  * &lt;li>sha224 - cryptojs&lt;/li>
<span class='line'>441</span>  * &lt;li>sha256 - cryptojs&lt;/li>
<span class='line'>442</span>  * &lt;li>sha384 - cryptojs&lt;/li>
<span class='line'>443</span>  * &lt;li>sha512 - cryptojs&lt;/li>
<span class='line'>444</span>  * &lt;li>ripemd160 - cryptojs&lt;/li>
<span class='line'>445</span>  * &lt;li>sha256 - sjcl (NEW from crypto.js 1.0.4)&lt;/li>
<span class='line'>446</span>  * &lt;/ul>
<span class='line'>447</span>  * @example
<span class='line'>448</span>  * // CryptoJS provider sample
<span class='line'>449</span>  * var md = new KJUR.crypto.MessageDigest({alg: "sha1", prov: "cryptojs"});
<span class='line'>450</span>  * md.updateString('aaa')
<span class='line'>451</span>  * var mdHex = md.digest()
<span class='line'>452</span>  *
<span class='line'>453</span>  * // SJCL(Stanford JavaScript Crypto Library) provider sample
<span class='line'>454</span>  * var md = new KJUR.crypto.MessageDigest({alg: "sha256", prov: "sjcl"}); // sjcl supports sha256 only
<span class='line'>455</span>  * md.updateString('aaa')
<span class='line'>456</span>  * var mdHex = md.digest()
<span class='line'>457</span>  *
<span class='line'>458</span>  * // HASHLENGTH property
<span class='line'>459</span>  * KJUR.crypto.MessageDigest.HASHLENGTH['sha1'] &rarr 20
<span class='line'>460</span>  * KJUR.crypto.MessageDigest.HASHLENGTH['sha512'] &rarr 64
<span class='line'>461</span>  */</span><span class="WHIT">
<span class='line'>462</span> </span><span class="NAME">KJUR.crypto.MessageDigest</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">params</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>463</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">md</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>464</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">algName</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>465</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">provName</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>466</span> 
<span class='line'>467</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>468</span>      * set hash algorithm and provider&lt;br/>
<span class='line'>469</span>      * @name setAlgAndProvider
<span class='line'>470</span>      * @memberOf KJUR.crypto.MessageDigest#
<span class='line'>471</span>      * @function
<span class='line'>472</span>      * @param {String} alg hash algorithm name
<span class='line'>473</span>      * @param {String} prov provider name
<span class='line'>474</span>      * @description
<span class='line'>475</span>      * This methods set an algorithm and a cryptographic provider.&lt;br/>
<span class='line'>476</span>      * Here is acceptable algorithm names ignoring cases and hyphens:
<span class='line'>477</span>      * &lt;ul>
<span class='line'>478</span>      * &lt;li>MD5&lt;/li>
<span class='line'>479</span>      * &lt;li>SHA1&lt;/li>
<span class='line'>480</span>      * &lt;li>SHA224&lt;/li>
<span class='line'>481</span>      * &lt;li>SHA256&lt;/li>
<span class='line'>482</span>      * &lt;li>SHA384&lt;/li>
<span class='line'>483</span>      * &lt;li>SHA512&lt;/li>
<span class='line'>484</span>      * &lt;li>RIPEMD160&lt;/li>
<span class='line'>485</span>      * &lt;/ul>
<span class='line'>486</span>      * NOTE: Since jsrsasign 6.2.0 crypto 1.1.10, this method ignores
<span class='line'>487</span>      * upper or lower cases. Also any hyphens (i.e. "-") will be ignored
<span class='line'>488</span>      * so that "SHA1" or "SHA-1" will be acceptable.
<span class='line'>489</span>      * @example
<span class='line'>490</span>      * // for SHA1
<span class='line'>491</span>      * md.setAlgAndProvider('sha1', 'cryptojs');
<span class='line'>492</span>      * md.setAlgAndProvider('SHA1');
<span class='line'>493</span>      * // for RIPEMD160
<span class='line'>494</span>      * md.setAlgAndProvider('ripemd160', 'cryptojs');
<span class='line'>495</span>      */</span><span class="WHIT">
<span class='line'>496</span> </span><span class="WHIT">    </span><span class="NAME">this.setAlgAndProvider</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">alg</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">prov</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>497</span> </span><span class="WHIT">	</span><span class="NAME">alg</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">KJUR.crypto.MessageDigest.getCanonicalAlgName</span><span class="PUNC">(</span><span class="NAME">alg</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>498</span> 
<span class='line'>499</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">alg</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">prov</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">prov</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">KJUR.crypto.Util.DEFAULTPROVIDER</span><span class="PUNC">[</span><span class="NAME">alg</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>500</span> 
<span class='line'>501</span> </span><span class="WHIT">	</span><span class="COMM">// for cryptojs</span><span class="WHIT">
<span class='line'>502</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="STRN">':md5:sha1:sha224:sha256:sha384:sha512:ripemd160:'</span><span class="PUNC">.</span><span class="NAME">indexOf</span><span class="PUNC">(</span><span class="NAME">alg</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT">
<span class='line'>503</span> </span><span class="WHIT">	    </span><span class="NAME">prov</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'cryptojs'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>504</span> </span><span class="WHIT">	    </span><span class="KEYW">try</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>505</span> </span><span class="WHIT">		</span><span class="NAME">this.md</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">KJUR.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME</span><span class="PUNC">[</span><span class="NAME">alg</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">create</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>506</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">catch</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">ex</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>507</span> </span><span class="WHIT">		</span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"setAlgAndProvider hash alg set fail alg="</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">alg</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"/"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">ex</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>508</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>509</span> </span><span class="WHIT">	    </span><span class="NAME">this.updateString</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">str</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>510</span> </span><span class="WHIT">		</span><span class="NAME">this.md.update</span><span class="PUNC">(</span><span class="NAME">str</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>511</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>512</span> </span><span class="WHIT">	    </span><span class="NAME">this.updateHex</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">hex</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>513</span> </span><span class="WHIT">		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">wHex</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">CryptoJS.enc.Hex.parse</span><span class="PUNC">(</span><span class="NAME">hex</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>514</span> </span><span class="WHIT">		</span><span class="NAME">this.md.update</span><span class="PUNC">(</span><span class="NAME">wHex</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>515</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>516</span> </span><span class="WHIT">	    </span><span class="NAME">this.digest</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>517</span> </span><span class="WHIT">		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">hash</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.md.finalize</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>518</span> </span><span class="WHIT">		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">hash.toString</span><span class="PUNC">(</span><span class="NAME">CryptoJS.enc.Hex</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>519</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>520</span> </span><span class="WHIT">	    </span><span class="NAME">this.digestString</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">str</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>521</span> </span><span class="WHIT">		</span><span class="NAME">this.updateString</span><span class="PUNC">(</span><span class="NAME">str</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>522</span> </span><span class="WHIT">		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.digest</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>523</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>524</span> </span><span class="WHIT">	    </span><span class="NAME">this.digestHex</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">hex</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>525</span> </span><span class="WHIT">		</span><span class="NAME">this.updateHex</span><span class="PUNC">(</span><span class="NAME">hex</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>526</span> </span><span class="WHIT">		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.digest</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>527</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>528</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>529</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="STRN">':sha256:'</span><span class="PUNC">.</span><span class="NAME">indexOf</span><span class="PUNC">(</span><span class="NAME">alg</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT">
<span class='line'>530</span> </span><span class="WHIT">	    </span><span class="NAME">prov</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'sjcl'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>531</span> </span><span class="WHIT">	    </span><span class="KEYW">try</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>532</span> </span><span class="WHIT">		</span><span class="NAME">this.md</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">sjcl.hash.sha256</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>533</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">catch</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">ex</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>534</span> </span><span class="WHIT">		</span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"setAlgAndProvider hash alg set fail alg="</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">alg</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"/"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">ex</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>535</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>536</span> </span><span class="WHIT">	    </span><span class="NAME">this.updateString</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">str</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>537</span> </span><span class="WHIT">		</span><span class="NAME">this.md.update</span><span class="PUNC">(</span><span class="NAME">str</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>538</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>539</span> </span><span class="WHIT">	    </span><span class="NAME">this.updateHex</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">hex</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>540</span> </span><span class="WHIT">		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">baHex</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sjcl.codec.hex.toBits</span><span class="PUNC">(</span><span class="NAME">hex</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>541</span> </span><span class="WHIT">		</span><span class="NAME">this.md.update</span><span class="PUNC">(</span><span class="NAME">baHex</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>542</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>543</span> </span><span class="WHIT">	    </span><span class="NAME">this.digest</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>544</span> </span><span class="WHIT">		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">hash</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.md.finalize</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>545</span> </span><span class="WHIT">		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">sjcl.codec.hex.fromBits</span><span class="PUNC">(</span><span class="NAME">hash</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>546</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>547</span> </span><span class="WHIT">	    </span><span class="NAME">this.digestString</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">str</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>548</span> </span><span class="WHIT">		</span><span class="NAME">this.updateString</span><span class="PUNC">(</span><span class="NAME">str</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>549</span> </span><span class="WHIT">		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.digest</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>550</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>551</span> </span><span class="WHIT">	    </span><span class="NAME">this.digestHex</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">hex</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>552</span> </span><span class="WHIT">		</span><span class="NAME">this.updateHex</span><span class="PUNC">(</span><span class="NAME">hex</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>553</span> </span><span class="WHIT">		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.digest</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>554</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>555</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>556</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>557</span> 
<span class='line'>558</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>559</span>      * update digest by specified string
<span class='line'>560</span>      * @name updateString
<span class='line'>561</span>      * @memberOf KJUR.crypto.MessageDigest#
<span class='line'>562</span>      * @function
<span class='line'>563</span>      * @param {String} str string to update
<span class='line'>564</span>      * @description
<span class='line'>565</span>      * @example
<span class='line'>566</span>      * md.updateString('New York');
<span class='line'>567</span>      */</span><span class="WHIT">
<span class='line'>568</span> </span><span class="WHIT">    </span><span class="NAME">this.updateString</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">str</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>569</span> </span><span class="WHIT">	</span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"updateString(str) not supported for this alg/prov: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this.algName</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"/"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this.provName</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>570</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>571</span> 
<span class='line'>572</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>573</span>      * update digest by specified hexadecimal string
<span class='line'>574</span>      * @name updateHex
<span class='line'>575</span>      * @memberOf KJUR.crypto.MessageDigest#
<span class='line'>576</span>      * @function
<span class='line'>577</span>      * @param {String} hex hexadecimal string to update
<span class='line'>578</span>      * @description
<span class='line'>579</span>      * @example
<span class='line'>580</span>      * md.updateHex('0afe36');
<span class='line'>581</span>      */</span><span class="WHIT">
<span class='line'>582</span> </span><span class="WHIT">    </span><span class="NAME">this.updateHex</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">hex</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>583</span> </span><span class="WHIT">	</span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"updateHex(hex) not supported for this alg/prov: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this.algName</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"/"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this.provName</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>584</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>585</span> 
<span class='line'>586</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>587</span>      * completes hash calculation and returns hash result
<span class='line'>588</span>      * @name digest
<span class='line'>589</span>      * @memberOf KJUR.crypto.MessageDigest#
<span class='line'>590</span>      * @function
<span class='line'>591</span>      * @description
<span class='line'>592</span>      * @example
<span class='line'>593</span>      * md.digest()
<span class='line'>594</span>      */</span><span class="WHIT">
<span class='line'>595</span> </span><span class="WHIT">    </span><span class="NAME">this.digest</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>596</span> </span><span class="WHIT">	</span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"digest() not supported for this alg/prov: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this.algName</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"/"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this.provName</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>597</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>598</span> 
<span class='line'>599</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>600</span>      * performs final update on the digest using string, then completes the digest computation
<span class='line'>601</span>      * @name digestString
<span class='line'>602</span>      * @memberOf KJUR.crypto.MessageDigest#
<span class='line'>603</span>      * @function
<span class='line'>604</span>      * @param {String} str string to final update
<span class='line'>605</span>      * @description
<span class='line'>606</span>      * @example
<span class='line'>607</span>      * md.digestString('aaa')
<span class='line'>608</span>      */</span><span class="WHIT">
<span class='line'>609</span> </span><span class="WHIT">    </span><span class="NAME">this.digestString</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">str</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>610</span> </span><span class="WHIT">	</span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"digestString(str) not supported for this alg/prov: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this.algName</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"/"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this.provName</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>611</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>612</span> 
<span class='line'>613</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>614</span>      * performs final update on the digest using hexadecimal string, then completes the digest computation
<span class='line'>615</span>      * @name digestHex
<span class='line'>616</span>      * @memberOf KJUR.crypto.MessageDigest#
<span class='line'>617</span>      * @function
<span class='line'>618</span>      * @param {String} hex hexadecimal string to final update
<span class='line'>619</span>      * @description
<span class='line'>620</span>      * @example
<span class='line'>621</span>      * md.digestHex('0f2abd')
<span class='line'>622</span>      */</span><span class="WHIT">
<span class='line'>623</span> </span><span class="WHIT">    </span><span class="NAME">this.digestHex</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">hex</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>624</span> </span><span class="WHIT">	</span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"digestHex(hex) not supported for this alg/prov: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this.algName</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"/"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this.provName</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>625</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>626</span> 
<span class='line'>627</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">params</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>628</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">params</span><span class="PUNC">[</span><span class="STRN">'alg'</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>629</span> </span><span class="WHIT">	    </span><span class="NAME">this.algName</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">params</span><span class="PUNC">[</span><span class="STRN">'alg'</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>630</span> </span><span class="WHIT">	    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">params</span><span class="PUNC">[</span><span class="STRN">'prov'</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>631</span> </span><span class="WHIT">		</span><span class="NAME">this.provName</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">KJUR.crypto.Util.DEFAULTPROVIDER</span><span class="PUNC">[</span><span class="NAME">this.algName</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>632</span> </span><span class="WHIT">	    </span><span class="NAME">this.setAlgAndProvider</span><span class="PUNC">(</span><span class="NAME">this.algName</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">this.provName</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>633</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>634</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>635</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>636</span> 
<span class='line'>637</span> </span><span class="COMM">/**
<span class='line'>638</span>  * get canonical hash algorithm name&lt;br/>
<span class='line'>639</span>  * @name getCanonicalAlgName
<span class='line'>640</span>  * @memberOf KJUR.crypto.MessageDigest
<span class='line'>641</span>  * @function
<span class='line'>642</span>  * @param {String} alg hash algorithm name (ex. MD5, SHA-1, SHA1, SHA512 et.al.)
<span class='line'>643</span>  * @return {String} canonical hash algorithm name
<span class='line'>644</span>  * @since jsrsasign 6.2.0 crypto 1.1.10
<span class='line'>645</span>  * @description
<span class='line'>646</span>  * This static method normalizes from any hash algorithm name such as
<span class='line'>647</span>  * "SHA-1", "SHA1", "MD5", "sha512" to lower case name without hyphens
<span class='line'>648</span>  * such as "sha1".
<span class='line'>649</span>  * @example
<span class='line'>650</span>  * KJUR.crypto.MessageDigest.getCanonicalAlgName("SHA-1") &rarr "sha1"
<span class='line'>651</span>  * KJUR.crypto.MessageDigest.getCanonicalAlgName("MD5")   &rarr "md5"
<span class='line'>652</span>  */</span><span class="WHIT">
<span class='line'>653</span> </span><span class="NAME">KJUR.crypto.MessageDigest.getCanonicalAlgName</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">alg</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>654</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">alg</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"string"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>655</span> </span><span class="WHIT">	</span><span class="NAME">alg</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">alg.toLowerCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>656</span> </span><span class="WHIT">	</span><span class="NAME">alg</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">alg.replace</span><span class="PUNC">(</span><span class="REGX">/-/</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>657</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>658</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">alg</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>659</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>660</span> 
<span class='line'>661</span> </span><span class="COMM">/**
<span class='line'>662</span>  * get resulted hash byte length for specified algorithm name&lt;br/>
<span class='line'>663</span>  * @name getHashLength
<span class='line'>664</span>  * @memberOf KJUR.crypto.MessageDigest
<span class='line'>665</span>  * @function
<span class='line'>666</span>  * @param {String} alg non-canonicalized hash algorithm name (ex. MD5, SHA-1, SHA1, SHA512 et.al.)
<span class='line'>667</span>  * @return {Integer} resulted hash byte length
<span class='line'>668</span>  * @since jsrsasign 6.2.0 crypto 1.1.10
<span class='line'>669</span>  * @description
<span class='line'>670</span>  * This static method returns resulted byte length for specified algorithm name such as "SHA-1".
<span class='line'>671</span>  * @example
<span class='line'>672</span>  * KJUR.crypto.MessageDigest.getHashLength("SHA-1") &rarr 20
<span class='line'>673</span>  * KJUR.crypto.MessageDigest.getHashLength("sha1") &rarr 20
<span class='line'>674</span>  */</span><span class="WHIT">
<span class='line'>675</span> </span><span class="NAME">KJUR.crypto.MessageDigest.getHashLength</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">alg</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>676</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">MD</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">KJUR.crypto.MessageDigest</span><span class="WHIT">
<span class='line'>677</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">alg2</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">MD.getCanonicalAlgName</span><span class="PUNC">(</span><span class="NAME">alg</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>678</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">MD.HASHLENGTH</span><span class="PUNC">[</span><span class="NAME">alg2</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>679</span> </span><span class="WHIT">	</span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"not supported algorithm: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">alg</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>680</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">MD.HASHLENGTH</span><span class="PUNC">[</span><span class="NAME">alg2</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>681</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>682</span> 
<span class='line'>683</span> </span><span class="COMM">// described in KJUR.crypto.MessageDigest class (since jsrsasign 6.2.0 crypto 1.1.10)</span><span class="WHIT">
<span class='line'>684</span> </span><span class="NAME">KJUR.crypto.MessageDigest.HASHLENGTH</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>685</span> </span><span class="WHIT">    </span><span class="STRN">'md5'</span><span class="PUNC">:</span><span class="WHIT">		</span><span class="NUMB">16</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>686</span> </span><span class="WHIT">    </span><span class="STRN">'sha1'</span><span class="PUNC">:</span><span class="WHIT">		</span><span class="NUMB">20</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>687</span> </span><span class="WHIT">    </span><span class="STRN">'sha224'</span><span class="PUNC">:</span><span class="WHIT">		</span><span class="NUMB">28</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>688</span> </span><span class="WHIT">    </span><span class="STRN">'sha256'</span><span class="PUNC">:</span><span class="WHIT">		</span><span class="NUMB">32</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>689</span> </span><span class="WHIT">    </span><span class="STRN">'sha384'</span><span class="PUNC">:</span><span class="WHIT">		</span><span class="NUMB">48</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>690</span> </span><span class="WHIT">    </span><span class="STRN">'sha512'</span><span class="PUNC">:</span><span class="WHIT">		</span><span class="NUMB">64</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>691</span> </span><span class="WHIT">    </span><span class="STRN">'ripemd160'</span><span class="PUNC">:</span><span class="WHIT">	</span><span class="NUMB">20</span><span class="WHIT">
<span class='line'>692</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>693</span> 
<span class='line'>694</span> </span><span class="COMM">// === Mac ===============================================================</span><span class="WHIT">
<span class='line'>695</span> 
<span class='line'>696</span> </span><span class="COMM">/**
<span class='line'>697</span>  * Mac(Message Authentication Code) class which is very similar to java.security.Mac class 
<span class='line'>698</span>  * @name KJUR.crypto.Mac
<span class='line'>699</span>  * @class Mac class which is very similar to java.security.Mac class
<span class='line'>700</span>  * @param {Array} params parameters for constructor
<span class='line'>701</span>  * @description
<span class='line'>702</span>  * &lt;br/>
<span class='line'>703</span>  * Currently this supports following algorithm and providers combination:
<span class='line'>704</span>  * &lt;ul>
<span class='line'>705</span>  * &lt;li>hmacmd5 - cryptojs&lt;/li>
<span class='line'>706</span>  * &lt;li>hmacsha1 - cryptojs&lt;/li>
<span class='line'>707</span>  * &lt;li>hmacsha224 - cryptojs&lt;/li>
<span class='line'>708</span>  * &lt;li>hmacsha256 - cryptojs&lt;/li>
<span class='line'>709</span>  * &lt;li>hmacsha384 - cryptojs&lt;/li>
<span class='line'>710</span>  * &lt;li>hmacsha512 - cryptojs&lt;/li>
<span class='line'>711</span>  * &lt;/ul>
<span class='line'>712</span>  * NOTE: HmacSHA224 and HmacSHA384 issue was fixed since jsrsasign 4.1.4.
<span class='line'>713</span>  * Please use 'ext/cryptojs-312-core-fix*.js' instead of 'core.js' of original CryptoJS
<span class='line'>714</span>  * to avoid those issue.
<span class='line'>715</span>  * &lt;br/>
<span class='line'>716</span>  * NOTE2: Hmac signature bug was fixed in jsrsasign 4.9.0 by providing CryptoJS
<span class='line'>717</span>  * bug workaround.
<span class='line'>718</span>  * &lt;br/>
<span class='line'>719</span>  * Please see {@link KJUR.crypto.Mac.setPassword}, how to provide password
<span class='line'>720</span>  * in various ways in detail.
<span class='line'>721</span>  * @example
<span class='line'>722</span>  * var mac = new KJUR.crypto.Mac({alg: "HmacSHA256", "pass": "pass"});
<span class='line'>723</span>  * mac.updateString('aaa')
<span class='line'>724</span>  * mac.doFinal() &rarr; "5737da..."
<span class='line'>725</span>  *
<span class='line'>726</span>  * // other password representation 
<span class='line'>727</span>  * var mac = new KJUR.crypto.Mac({alg: "HmacSHA256", "pass": {"hex":  "6161"}});
<span class='line'>728</span>  * var mac = new KJUR.crypto.Mac({alg: "HmacSHA256", "pass": {"utf8": "aa"}});
<span class='line'>729</span>  * var mac = new KJUR.crypto.Mac({alg: "HmacSHA256", "pass": {"rstr": "\x61\x61"}});
<span class='line'>730</span>  * var mac = new KJUR.crypto.Mac({alg: "HmacSHA256", "pass": {"b64":  "Mi02/+...a=="}});
<span class='line'>731</span>  * var mac = new KJUR.crypto.Mac({alg: "HmacSHA256", "pass": {"b64u": "Mi02_-...a"}});
<span class='line'>732</span>  */</span><span class="WHIT">
<span class='line'>733</span> </span><span class="NAME">KJUR.crypto.Mac</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">params</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>734</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">mac</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>735</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">pass</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>736</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">algName</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>737</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">provName</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>738</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">algProv</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>739</span> 
<span class='line'>740</span> </span><span class="WHIT">    </span><span class="NAME">this.setAlgAndProvider</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">alg</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">prov</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>741</span> </span><span class="WHIT">	</span><span class="NAME">alg</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">alg.toLowerCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>742</span> 
<span class='line'>743</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">alg</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">alg</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"hmacsha1"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>744</span> 
<span class='line'>745</span> </span><span class="WHIT">	</span><span class="NAME">alg</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">alg.toLowerCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>746</span> </span><span class="WHIT">        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">alg.substr</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">4</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">"hmac"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>747</span> </span><span class="WHIT">	    </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"setAlgAndProvider unsupported HMAC alg: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">alg</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>748</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>749</span> 
<span class='line'>750</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">prov</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">prov</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">KJUR.crypto.Util.DEFAULTPROVIDER</span><span class="PUNC">[</span><span class="NAME">alg</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>751</span> </span><span class="WHIT">	</span><span class="NAME">this.algProv</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">alg</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"/"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">prov</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>752</span> 
<span class='line'>753</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">hashAlg</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">alg.substr</span><span class="PUNC">(</span><span class="NUMB">4</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>754</span> 
<span class='line'>755</span> </span><span class="WHIT">	</span><span class="COMM">// for cryptojs</span><span class="WHIT">
<span class='line'>756</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="STRN">':md5:sha1:sha224:sha256:sha384:sha512:ripemd160:'</span><span class="PUNC">.</span><span class="NAME">indexOf</span><span class="PUNC">(</span><span class="NAME">hashAlg</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT">
<span class='line'>757</span> </span><span class="WHIT">	    </span><span class="NAME">prov</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'cryptojs'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>758</span> </span><span class="WHIT">	    </span><span class="KEYW">try</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>759</span> </span><span class="WHIT">		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">mdObj</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">KJUR.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME</span><span class="PUNC">[</span><span class="NAME">hashAlg</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>760</span> </span><span class="WHIT">		</span><span class="NAME">this.mac</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">CryptoJS.algo.HMAC.create</span><span class="PUNC">(</span><span class="NAME">mdObj</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">this.pass</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>761</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">catch</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">ex</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>762</span> </span><span class="WHIT">		</span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"setAlgAndProvider hash alg set fail hashAlg="</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">hashAlg</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"/"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">ex</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>763</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>764</span> </span><span class="WHIT">	    </span><span class="NAME">this.updateString</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">str</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>765</span> </span><span class="WHIT">		</span><span class="NAME">this.mac.update</span><span class="PUNC">(</span><span class="NAME">str</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>766</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>767</span> </span><span class="WHIT">	    </span><span class="NAME">this.updateHex</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">hex</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>768</span> </span><span class="WHIT">		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">wHex</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">CryptoJS.enc.Hex.parse</span><span class="PUNC">(</span><span class="NAME">hex</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>769</span> </span><span class="WHIT">		</span><span class="NAME">this.mac.update</span><span class="PUNC">(</span><span class="NAME">wHex</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>770</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>771</span> </span><span class="WHIT">	    </span><span class="NAME">this.doFinal</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>772</span> </span><span class="WHIT">		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">hash</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.mac.finalize</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>773</span> </span><span class="WHIT">		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">hash.toString</span><span class="PUNC">(</span><span class="NAME">CryptoJS.enc.Hex</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>774</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>775</span> </span><span class="WHIT">	    </span><span class="NAME">this.doFinalString</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">str</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>776</span> </span><span class="WHIT">		</span><span class="NAME">this.updateString</span><span class="PUNC">(</span><span class="NAME">str</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>777</span> </span><span class="WHIT">		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.doFinal</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>778</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>779</span> </span><span class="WHIT">	    </span><span class="NAME">this.doFinalHex</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">hex</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>780</span> </span><span class="WHIT">		</span><span class="NAME">this.updateHex</span><span class="PUNC">(</span><span class="NAME">hex</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>781</span> </span><span class="WHIT">		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.doFinal</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>782</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>783</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>784</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>785</span> 
<span class='line'>786</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>787</span>      * update digest by specified string&lt;br/>
<span class='line'>788</span>      * @name updateString
<span class='line'>789</span>      * @memberOf KJUR.crypto.Mac#
<span class='line'>790</span>      * @function
<span class='line'>791</span>      * @param {String} str string to update
<span class='line'>792</span>      *
<span class='line'>793</span>      * @description
<span class='line'>794</span>      * @example
<span class='line'>795</span>      * var mac = new KJUR.crypto.Mac({alg: "HmacSHA256", "pass": "pass"});
<span class='line'>796</span>      * mac.updateString('aaa')
<span class='line'>797</span>      * mac.doFinal() &rarr; "5737da..."
<span class='line'>798</span>      */</span><span class="WHIT">
<span class='line'>799</span> </span><span class="WHIT">    </span><span class="NAME">this.updateString</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">str</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>800</span> </span><span class="WHIT">	</span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"updateString(str) not supported for this alg/prov: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this.algProv</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>801</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>802</span> 
<span class='line'>803</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>804</span>      * update digest by specified hexadecimal string&lt;br/>
<span class='line'>805</span>      * @name updateHex
<span class='line'>806</span>      * @memberOf KJUR.crypto.Mac#
<span class='line'>807</span>      * @function
<span class='line'>808</span>      * @param {String} hex hexadecimal string to update
<span class='line'>809</span>      *
<span class='line'>810</span>      * @description
<span class='line'>811</span>      * @example
<span class='line'>812</span>      * var mac = new KJUR.crypto.Mac({alg: "HmacSHA256", "pass": "pass"});
<span class='line'>813</span>      * mac.updateHex('616161')
<span class='line'>814</span>      * mac.doFinal() &rarr; "5737da..."
<span class='line'>815</span>      */</span><span class="WHIT">
<span class='line'>816</span> </span><span class="WHIT">    </span><span class="NAME">this.updateHex</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">hex</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>817</span> </span><span class="WHIT">	</span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"updateHex(hex) not supported for this alg/prov: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this.algProv</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>818</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>819</span> 
<span class='line'>820</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>821</span>      * completes hash calculation and returns hash result&lt;br/>
<span class='line'>822</span>      * @name doFinal
<span class='line'>823</span>      * @memberOf KJUR.crypto.Mac#
<span class='line'>824</span>      * @function
<span class='line'>825</span>      * @returns hexadecimal string of Mac result value
<span class='line'>826</span>      *
<span class='line'>827</span>      * @description
<span class='line'>828</span>      * @example
<span class='line'>829</span>      * var mac = new KJUR.crypto.Mac({alg: "HmacSHA256", "pass": "pass"});
<span class='line'>830</span>      * mac.updateString('aaa')
<span class='line'>831</span>      * mac.doFinal() &rarr; "5737da..."
<span class='line'>832</span>      */</span><span class="WHIT">
<span class='line'>833</span> </span><span class="WHIT">    </span><span class="NAME">this.doFinal</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>834</span> </span><span class="WHIT">	</span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"digest() not supported for this alg/prov: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this.algProv</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>835</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>836</span> 
<span class='line'>837</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>838</span>      * performs final update on the digest using string, then completes the digest computation&lt;br/>
<span class='line'>839</span>      * @name doFinalString
<span class='line'>840</span>      * @memberOf KJUR.crypto.Mac#
<span class='line'>841</span>      * @function
<span class='line'>842</span>      * @param {String} str raw string to final update
<span class='line'>843</span>      * @returns hexadecimal string of Mac result value
<span class='line'>844</span>      *
<span class='line'>845</span>      * @description
<span class='line'>846</span>      * @example
<span class='line'>847</span>      * var mac = new KJUR.crypto.Mac({alg: "HmacSHA256", "pass": "pass"});
<span class='line'>848</span>      * mac.doFinalString("aaa") &rarr; "5737da..."
<span class='line'>849</span>      */</span><span class="WHIT">
<span class='line'>850</span> </span><span class="WHIT">    </span><span class="NAME">this.doFinalString</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">str</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>851</span> </span><span class="WHIT">	</span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"digestString(str) not supported for this alg/prov: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this.algProv</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>852</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>853</span> 
<span class='line'>854</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>855</span>      * performs final update on the digest using hexadecimal string, then completes the digest computation&lt;br/>
<span class='line'>856</span>      * @name doFinalHex
<span class='line'>857</span>      * @memberOf KJUR.crypto.Mac#
<span class='line'>858</span>      * @function
<span class='line'>859</span>      * @param {String} hex hexadecimal string to final update
<span class='line'>860</span>      * @returns hexadecimal string of Mac result value
<span class='line'>861</span>      *
<span class='line'>862</span>      * @description
<span class='line'>863</span>      * @example
<span class='line'>864</span>      * var mac = new KJUR.crypto.Mac({alg: "HmacSHA256", "pass": "pass"});
<span class='line'>865</span>      * mac.doFinalHex("616161") &rarr; "5737da..."
<span class='line'>866</span>      */</span><span class="WHIT">
<span class='line'>867</span> </span><span class="WHIT">    </span><span class="NAME">this.doFinalHex</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">hex</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>868</span> </span><span class="WHIT">	</span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"digestHex(hex) not supported for this alg/prov: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this.algProv</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>869</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>870</span> 
<span class='line'>871</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>872</span>      * set password for Mac&lt;br/>
<span class='line'>873</span>      * @name setPassword
<span class='line'>874</span>      * @memberOf KJUR.crypto.Mac#
<span class='line'>875</span>      * @function
<span class='line'>876</span>      * @param {Object} pass password for Mac
<span class='line'>877</span>      * @since crypto 1.1.7 jsrsasign 4.9.0
<span class='line'>878</span>      * @description
<span class='line'>879</span>      * This method will set password for (H)Mac internally.
<span class='line'>880</span>      * Argument 'pass' can be specified as following:
<span class='line'>881</span>      * &lt;ul>
<span class='line'>882</span>      * &lt;li>even length string of 0..9, a..f or A-F: implicitly specified as hexadecimal string&lt;/li>
<span class='line'>883</span>      * &lt;li>not above string: implicitly specified as raw string&lt;/li>
<span class='line'>884</span>      * &lt;li>{rstr: "\x65\x70"}: explicitly specified as raw string&lt;/li>
<span class='line'>885</span>      * &lt;li>{hex: "6570"}: explicitly specified as hexacedimal string&lt;/li>
<span class='line'>886</span>      * &lt;li>{utf8: "秘密"}: explicitly specified as UTF8 string&lt;/li>
<span class='line'>887</span>      * &lt;li>{b64: "Mi78..=="}: explicitly specified as Base64 string&lt;/li>
<span class='line'>888</span>      * &lt;li>{b64u: "Mi7-_"}: explicitly specified as Base64URL string&lt;/li>
<span class='line'>889</span>      * &lt;/ul>
<span class='line'>890</span>      * It is *STRONGLY RECOMMENDED* that explicit representation of password argument
<span class='line'>891</span>      * to avoid ambiguity. For example string  "6161" can mean a string "6161" or 
<span class='line'>892</span>      * a hexadecimal string of "aa" (i.e. \x61\x61).
<span class='line'>893</span>      * @example
<span class='line'>894</span>      * mac = KJUR.crypto.Mac({'alg': 'hmacsha256'});
<span class='line'>895</span>      * // set password by implicit raw string
<span class='line'>896</span>      * mac.setPassword("\x65\x70\xb9\x0b");
<span class='line'>897</span>      * mac.setPassword("password");
<span class='line'>898</span>      * // set password by implicit hexadecimal string
<span class='line'>899</span>      * mac.setPassword("6570b90b");
<span class='line'>900</span>      * mac.setPassword("6570B90B");
<span class='line'>901</span>      * // set password by explicit raw string
<span class='line'>902</span>      * mac.setPassword({"rstr": "\x65\x70\xb9\x0b"});
<span class='line'>903</span>      * // set password by explicit hexadecimal string
<span class='line'>904</span>      * mac.setPassword({"hex": "6570b90b"});
<span class='line'>905</span>      * // set password by explicit utf8 string
<span class='line'>906</span>      * mac.setPassword({"utf8": "passwordパスワード");
<span class='line'>907</span>      * // set password by explicit Base64 string
<span class='line'>908</span>      * mac.setPassword({"b64": "Mb+c3f/=="});
<span class='line'>909</span>      * // set password by explicit Base64URL string
<span class='line'>910</span>      * mac.setPassword({"b64u": "Mb-c3f_"});
<span class='line'>911</span>      */</span><span class="WHIT">
<span class='line'>912</span> </span><span class="WHIT">    </span><span class="NAME">this.setPassword</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">pass</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>913</span> </span><span class="WHIT">	</span><span class="COMM">// internal this.pass shall be CryptoJS DWord Object for CryptoJS bug</span><span class="WHIT">
<span class='line'>914</span> </span><span class="WHIT">	</span><span class="COMM">// work around. CrytoJS HMac password can be passed by</span><span class="WHIT">
<span class='line'>915</span> </span><span class="WHIT">	</span><span class="COMM">// raw string as described in the manual however it doesn't</span><span class="WHIT">
<span class='line'>916</span> </span><span class="WHIT">	</span><span class="COMM">// work properly in some case. If password was passed</span><span class="WHIT">
<span class='line'>917</span> </span><span class="WHIT">	</span><span class="COMM">// by CryptoJS DWord which is not described in the manual</span><span class="WHIT">
<span class='line'>918</span> </span><span class="WHIT">	</span><span class="COMM">// it seems to work. (fixed since crypto 1.1.7)</span><span class="WHIT">
<span class='line'>919</span> 
<span class='line'>920</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">pass</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'string'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>921</span> </span><span class="WHIT">	    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">hPass</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">pass</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>922</span> </span><span class="WHIT">	    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">pass.length</span><span class="WHIT"> </span><span class="PUNC">%</span><span class="WHIT"> </span><span class="NUMB">2</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="WHIT"> </span><span class="NAME">pass.match</span><span class="PUNC">(</span><span class="REGX">/^[0-9A-Fa-f]+$/</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="COMM">// raw str</span><span class="WHIT">
<span class='line'>923</span> </span><span class="WHIT">		</span><span class="NAME">hPass</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">rstrtohex</span><span class="PUNC">(</span><span class="NAME">pass</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>924</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>925</span> </span><span class="WHIT">	    </span><span class="NAME">this.pass</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">CryptoJS.enc.Hex.parse</span><span class="PUNC">(</span><span class="NAME">hPass</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>926</span> </span><span class="WHIT">	    </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>927</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>928</span> 
<span class='line'>929</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">pass</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">'object'</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>930</span> </span><span class="WHIT">	    </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"KJUR.crypto.Mac unsupported password type: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">pass</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>931</span> </span><span class="WHIT">	
<span class='line'>932</span> 	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">hPass</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>933</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">pass.hex</span><span class="WHIT">  </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>934</span> </span><span class="WHIT">	    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">pass.hex.length</span><span class="WHIT"> </span><span class="PUNC">%</span><span class="WHIT"> </span><span class="NUMB">2</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="WHIT"> </span><span class="NAME">pass.hex.match</span><span class="PUNC">(</span><span class="REGX">/^[0-9A-Fa-f]+$/</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>935</span> </span><span class="WHIT">		</span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"Mac: wrong hex password: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">pass.hex</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>936</span> </span><span class="WHIT">	    </span><span class="NAME">hPass</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">pass.hex</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>937</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>938</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">pass.utf8</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">hPass</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">utf8tohex</span><span class="PUNC">(</span><span class="NAME">pass.utf8</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>939</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">pass.rstr</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">hPass</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">rstrtohex</span><span class="PUNC">(</span><span class="NAME">pass.rstr</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>940</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">pass.b64</span><span class="WHIT">  </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">hPass</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">b64tohex</span><span class="PUNC">(</span><span class="NAME">pass.b64</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>941</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">pass.b64u</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">hPass</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">b64utohex</span><span class="PUNC">(</span><span class="NAME">pass.b64u</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>942</span> 
<span class='line'>943</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">hPass</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>944</span> </span><span class="WHIT">	    </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"KJUR.crypto.Mac unsupported password type: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">pass</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>945</span> 
<span class='line'>946</span> </span><span class="WHIT">	</span><span class="NAME">this.pass</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">CryptoJS.enc.Hex.parse</span><span class="PUNC">(</span><span class="NAME">hPass</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>947</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>948</span> 
<span class='line'>949</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">params</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>950</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">params.pass</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>951</span> </span><span class="WHIT">	    </span><span class="NAME">this.setPassword</span><span class="PUNC">(</span><span class="NAME">params.pass</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>952</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>953</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">params.alg</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>954</span> </span><span class="WHIT">	    </span><span class="NAME">this.algName</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">params.alg</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>955</span> </span><span class="WHIT">	    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">params</span><span class="PUNC">[</span><span class="STRN">'prov'</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>956</span> </span><span class="WHIT">		</span><span class="NAME">this.provName</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">KJUR.crypto.Util.DEFAULTPROVIDER</span><span class="PUNC">[</span><span class="NAME">this.algName</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>957</span> </span><span class="WHIT">	    </span><span class="NAME">this.setAlgAndProvider</span><span class="PUNC">(</span><span class="NAME">this.algName</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">this.provName</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>958</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>959</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>960</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>961</span> 
<span class='line'>962</span> </span><span class="COMM">// ====== Signature class ====================================================</span><span class="WHIT">
<span class='line'>963</span> </span><span class="COMM">/**
<span class='line'>964</span>  * Signature class which is very similar to java.security.Signature class
<span class='line'>965</span>  * @name KJUR.crypto.Signature
<span class='line'>966</span>  * @class Signature class which is very similar to java.security.Signature class
<span class='line'>967</span>  * @param {Array} params parameters for constructor
<span class='line'>968</span>  * @property {String} state Current state of this signature object whether 'SIGN', 'VERIFY' or null
<span class='line'>969</span>  * @description
<span class='line'>970</span>  * &lt;br/>
<span class='line'>971</span>  * As for params of constructor's argument, it can be specify following attributes:
<span class='line'>972</span>  * &lt;ul>
<span class='line'>973</span>  * &lt;li>alg - signature algorithm name (ex. {MD5,SHA1,SHA224,SHA256,SHA384,SHA512,RIPEMD160}with{RSA,ECDSA,DSA})&lt;/li>
<span class='line'>974</span>  * &lt;li>provider - currently 'cryptojs/jsrsa' only&lt;/li>
<span class='line'>975</span>  * &lt;/ul>
<span class='line'>976</span>  * &lt;h4>SUPPORTED ALGORITHMS AND PROVIDERS&lt;/h4>
<span class='line'>977</span>  * This Signature class supports following signature algorithm and provider names:
<span class='line'>978</span>  * &lt;ul>
<span class='line'>979</span>  * &lt;li>MD5withRSA - cryptojs/jsrsa&lt;/li>
<span class='line'>980</span>  * &lt;li>SHA1withRSA - cryptojs/jsrsa&lt;/li>
<span class='line'>981</span>  * &lt;li>SHA224withRSA - cryptojs/jsrsa&lt;/li>
<span class='line'>982</span>  * &lt;li>SHA256withRSA - cryptojs/jsrsa&lt;/li>
<span class='line'>983</span>  * &lt;li>SHA384withRSA - cryptojs/jsrsa&lt;/li>
<span class='line'>984</span>  * &lt;li>SHA512withRSA - cryptojs/jsrsa&lt;/li>
<span class='line'>985</span>  * &lt;li>RIPEMD160withRSA - cryptojs/jsrsa&lt;/li>
<span class='line'>986</span>  * &lt;li>MD5withECDSA - cryptojs/jsrsa&lt;/li>
<span class='line'>987</span>  * &lt;li>SHA1withECDSA - cryptojs/jsrsa&lt;/li>
<span class='line'>988</span>  * &lt;li>SHA224withECDSA - cryptojs/jsrsa&lt;/li>
<span class='line'>989</span>  * &lt;li>SHA256withECDSA - cryptojs/jsrsa&lt;/li>
<span class='line'>990</span>  * &lt;li>SHA384withECDSA - cryptojs/jsrsa&lt;/li>
<span class='line'>991</span>  * &lt;li>SHA512withECDSA - cryptojs/jsrsa&lt;/li>
<span class='line'>992</span>  * &lt;li>RIPEMD160withECDSA - cryptojs/jsrsa&lt;/li>
<span class='line'>993</span>  * &lt;li>MD5withRSAandMGF1 - cryptojs/jsrsa&lt;/li>
<span class='line'>994</span>  * &lt;li>SHAwithRSAandMGF1 - cryptojs/jsrsa&lt;/li>
<span class='line'>995</span>  * &lt;li>SHA1withRSAandMGF1 - cryptojs/jsrsa&lt;/li>
<span class='line'>996</span>  * &lt;li>SHA224withRSAandMGF1 - cryptojs/jsrsa&lt;/li>
<span class='line'>997</span>  * &lt;li>SHA256withRSAandMGF1 - cryptojs/jsrsa&lt;/li>
<span class='line'>998</span>  * &lt;li>SHA384withRSAandMGF1 - cryptojs/jsrsa&lt;/li>
<span class='line'>999</span>  * &lt;li>SHA512withRSAandMGF1 - cryptojs/jsrsa&lt;/li>
<span class='line'>1000</span>  * &lt;li>RIPEMD160withRSAandMGF1 - cryptojs/jsrsa&lt;/li>
<span class='line'>1001</span>  * &lt;li>SHA1withDSA - cryptojs/jsrsa&lt;/li>
<span class='line'>1002</span>  * &lt;li>SHA224withDSA - cryptojs/jsrsa&lt;/li>
<span class='line'>1003</span>  * &lt;li>SHA256withDSA - cryptojs/jsrsa&lt;/li>
<span class='line'>1004</span>  * &lt;/ul>
<span class='line'>1005</span>  * As for RSA-PSS signature algorithm names and signing parameters 
<span class='line'>1006</span>  * such as MGF function and salt length, please see
<span class='line'>1007</span>  * {@link KJUR.asn1.x509.AlgorithmIdentifier} class.
<span class='line'>1008</span>  *
<span class='line'>1009</span>  * Here are supported elliptic cryptographic curve names and their aliases for ECDSA:
<span class='line'>1010</span>  * &lt;ul>
<span class='line'>1011</span>  * &lt;li>secp256k1&lt;/li>
<span class='line'>1012</span>  * &lt;li>secp256r1, NIST P-256, P-256, prime256v1&lt;/li>
<span class='line'>1013</span>  * &lt;li>secp384r1, NIST P-384, P-384&lt;/li>
<span class='line'>1014</span>  * &lt;li>secp521r1, NIST P-521, P-521&lt;/li>
<span class='line'>1015</span>  * &lt;/ul>
<span class='line'>1016</span>  * NOTE1: DSA signing algorithm is also supported since crypto 1.1.5.
<span class='line'>1017</span>  * &lt;h4>EXAMPLES&lt;/h4>
<span class='line'>1018</span>  * @example
<span class='line'>1019</span>  * // RSA signature generation
<span class='line'>1020</span>  * var sig = new KJUR.crypto.Signature({"alg": "SHA1withRSA"});
<span class='line'>1021</span>  * sig.init(prvKeyPEM);
<span class='line'>1022</span>  * sig.updateString('aaa');
<span class='line'>1023</span>  * var hSigVal = sig.sign();
<span class='line'>1024</span>  *
<span class='line'>1025</span>  * // DSA signature validation
<span class='line'>1026</span>  * var sig2 = new KJUR.crypto.Signature({"alg": "SHA1withDSA"});
<span class='line'>1027</span>  * sig2.init(certPEM);
<span class='line'>1028</span>  * sig.updateString('aaa');
<span class='line'>1029</span>  * var isValid = sig2.verify(hSigVal);
<span class='line'>1030</span>  * 
<span class='line'>1031</span>  * // ECDSA signing
<span class='line'>1032</span>  * var sig = new KJUR.crypto.Signature({'alg':'SHA1withECDSA'});
<span class='line'>1033</span>  * sig.init(prvKeyPEM);
<span class='line'>1034</span>  * sig.updateString('aaa');
<span class='line'>1035</span>  * var sigValueHex = sig.sign();
<span class='line'>1036</span>  *
<span class='line'>1037</span>  * // ECDSA verifying
<span class='line'>1038</span>  * var sig2 = new KJUR.crypto.Signature({'alg':'SHA1withECDSA'});
<span class='line'>1039</span>  * sig.init(certPEM);
<span class='line'>1040</span>  * sig.updateString('aaa');
<span class='line'>1041</span>  * var isValid = sig.verify(sigValueHex);
<span class='line'>1042</span>  */</span><span class="WHIT">
<span class='line'>1043</span> </span><span class="NAME">KJUR.crypto.Signature</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">params</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1044</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">prvKey</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">// RSAKey/KJUR.crypto.{ECDSA,DSA} object for signing</span><span class="WHIT">
<span class='line'>1045</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">pubKey</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">// RSAKey/KJUR.crypto.{ECDSA,DSA} object for verifying</span><span class="WHIT">
<span class='line'>1046</span> 
<span class='line'>1047</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">md</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">// KJUR.crypto.MessageDigest object</span><span class="WHIT">
<span class='line'>1048</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">sig</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1049</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">algName</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1050</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">provName</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1051</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">algProvName</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1052</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">mdAlgName</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1053</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">pubkeyAlgName</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">	</span><span class="COMM">// rsa,ecdsa,rsaandmgf1(=rsapss)</span><span class="WHIT">
<span class='line'>1054</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">state</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1055</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">pssSaltLen</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1056</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">initParams</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1057</span> 
<span class='line'>1058</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">sHashHex</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">// hex hash value for hex</span><span class="WHIT">
<span class='line'>1059</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">hDigestInfo</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1060</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">hPaddedDigestInfo</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1061</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">hSign</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1062</span> 
<span class='line'>1063</span> </span><span class="WHIT">    </span><span class="NAME">this._setAlgNames</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1064</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">matchResult</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.algName.match</span><span class="PUNC">(</span><span class="REGX">/^(.+)with(.+)$/</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1065</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">matchResult</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1066</span> </span><span class="WHIT">	    </span><span class="NAME">this.mdAlgName</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">matchResult</span><span class="PUNC">[</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">toLowerCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1067</span> </span><span class="WHIT">	    </span><span class="NAME">this.pubkeyAlgName</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">matchResult</span><span class="PUNC">[</span><span class="NUMB">2</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">toLowerCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1068</span> </span><span class="WHIT">	    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.pubkeyAlgName</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"rsaandmgf1"</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT">
<span class='line'>1069</span> </span><span class="WHIT">	        </span><span class="NAME">this.mdAlgName</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"sha"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1070</span> </span><span class="WHIT">		</span><span class="NAME">this.mdAlgName</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"sha1"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1071</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1072</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1073</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1074</span> 
<span class='line'>1075</span> </span><span class="WHIT">    </span><span class="NAME">this._zeroPaddingOfSignature</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">hex</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">bitLength</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1076</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">s</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1077</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">nZero</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">bitLength</span><span class="WHIT"> </span><span class="PUNC">/</span><span class="WHIT"> </span><span class="NUMB">4</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">hex.length</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1078</span> </span><span class="WHIT">	</span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">nZero</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1079</span> </span><span class="WHIT">	    </span><span class="NAME">s</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">s</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"0"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1080</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1081</span> </span><span class="WHIT">	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">s</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">hex</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1082</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1083</span> 
<span class='line'>1084</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>1085</span>      * set signature algorithm and provider
<span class='line'>1086</span>      * @name setAlgAndProvider
<span class='line'>1087</span>      * @memberOf KJUR.crypto.Signature#
<span class='line'>1088</span>      * @function
<span class='line'>1089</span>      * @param {String} alg signature algorithm name
<span class='line'>1090</span>      * @param {String} prov provider name
<span class='line'>1091</span>      * @description
<span class='line'>1092</span>      * @example
<span class='line'>1093</span>      * md.setAlgAndProvider('SHA1withRSA', 'cryptojs/jsrsa');
<span class='line'>1094</span>      */</span><span class="WHIT">
<span class='line'>1095</span> </span><span class="WHIT">    </span><span class="NAME">this.setAlgAndProvider</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">alg</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">prov</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1096</span> </span><span class="WHIT">	</span><span class="NAME">this._setAlgNames</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1097</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">prov</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">'cryptojs/jsrsa'</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>1098</span> </span><span class="WHIT">	    </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">(</span><span class="STRN">"provider not supported: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">prov</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1099</span> 
<span class='line'>1100</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="STRN">':md5:sha1:sha224:sha256:sha384:sha512:ripemd160:'</span><span class="PUNC">.</span><span class="NAME">indexOf</span><span class="PUNC">(</span><span class="NAME">this.mdAlgName</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1101</span> </span><span class="WHIT">	    </span><span class="KEYW">try</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1102</span> </span><span class="WHIT">		</span><span class="NAME">this.md</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">KJUR.crypto.MessageDigest</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="STRN">'alg'</span><span class="PUNC">:</span><span class="NAME">this.mdAlgName</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1103</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">catch</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">ex</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1104</span> </span><span class="WHIT">		</span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">(</span><span class="STRN">"setAlgAndProvider hash alg set fail alg="</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
<span class='line'>1105</span> </span><span class="WHIT">				</span><span class="NAME">this.mdAlgName</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"/"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">ex</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1106</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1107</span> </span><span class="WHIT">	    
<span class='line'>1108</span> 	    </span><span class="NAME">this.init</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">keyparam</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">pass</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1109</span> </span><span class="WHIT">		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">keyObj</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1110</span> </span><span class="WHIT">		</span><span class="KEYW">try</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1111</span> </span><span class="WHIT">		    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">pass</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1112</span> </span><span class="WHIT">			</span><span class="NAME">keyObj</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">KEYUTIL.getKey</span><span class="PUNC">(</span><span class="NAME">keyparam</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1113</span> </span><span class="WHIT">		    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1114</span> </span><span class="WHIT">			</span><span class="NAME">keyObj</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">KEYUTIL.getKey</span><span class="PUNC">(</span><span class="NAME">keyparam</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">pass</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1115</span> </span><span class="WHIT">		    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1116</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">catch</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">ex</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1117</span> </span><span class="WHIT">		    </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"init failed:"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">ex</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1118</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1119</span> 
<span class='line'>1120</span> </span><span class="WHIT">		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">keyObj.isPrivate</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1121</span> </span><span class="WHIT">		    </span><span class="NAME">this.prvKey</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">keyObj</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1122</span> </span><span class="WHIT">		    </span><span class="NAME">this.state</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"SIGN"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1123</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">keyObj.isPublic</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1124</span> </span><span class="WHIT">		    </span><span class="NAME">this.pubKey</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">keyObj</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1125</span> </span><span class="WHIT">		    </span><span class="NAME">this.state</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"VERIFY"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1126</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1127</span> </span><span class="WHIT">		    </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"init failed.:"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">keyObj</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1128</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1129</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1130</span> 
<span class='line'>1131</span> </span><span class="WHIT">	    </span><span class="NAME">this.updateString</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">str</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1132</span> </span><span class="WHIT">		</span><span class="NAME">this.md.updateString</span><span class="PUNC">(</span><span class="NAME">str</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1133</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1134</span> 
<span class='line'>1135</span> </span><span class="WHIT">	    </span><span class="NAME">this.updateHex</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">hex</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1136</span> </span><span class="WHIT">		</span><span class="NAME">this.md.updateHex</span><span class="PUNC">(</span><span class="NAME">hex</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1137</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1138</span> 
<span class='line'>1139</span> </span><span class="WHIT">	    </span><span class="NAME">this.sign</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1140</span> </span><span class="WHIT">		</span><span class="NAME">this.sHashHex</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.md.digest</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1141</span> </span><span class="WHIT">		</span><span class="COMM">// hex parameter EC public key</span><span class="WHIT">
<span class='line'>1142</span> </span><span class="WHIT">		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.prvKey</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT">
<span class='line'>1143</span> </span><span class="WHIT">		    </span><span class="NAME">this.ecprvhex</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT">
<span class='line'>1144</span> </span><span class="WHIT">		    </span><span class="NAME">this.eccurvename</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT">
<span class='line'>1145</span> </span><span class="WHIT">		    </span><span class="NAME">KJUR.crypto.ECDSA</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1146</span> </span><span class="WHIT">		    </span><span class="NAME">this.prvKey</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">KJUR.crypto.ECDSA</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="STRN">'curve'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">this.eccurvename</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1147</span> </span><span class="WHIT">							 </span><span class="NAME">prv</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">this.ecprvhex</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1148</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1149</span> 
<span class='line'>1150</span> </span><span class="WHIT">		</span><span class="COMM">// RSAPSS</span><span class="WHIT">
<span class='line'>1151</span> </span><span class="WHIT">		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.prvKey</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">RSAKey</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT">
<span class='line'>1152</span> </span><span class="WHIT">		    </span><span class="NAME">this.pubkeyAlgName</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"rsaandmgf1"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1153</span> </span><span class="WHIT">		    </span><span class="NAME">this.hSign</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.prvKey.signWithMessageHashPSS</span><span class="PUNC">(</span><span class="NAME">this.sHashHex</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1154</span> </span><span class="WHIT">								    </span><span class="NAME">this.mdAlgName</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1155</span> </span><span class="WHIT">								    </span><span class="NAME">this.pssSaltLen</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1156</span> </span><span class="WHIT">		</span><span class="COMM">// RSA</span><span class="WHIT">
<span class='line'>1157</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.prvKey</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">RSAKey</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT">
<span class='line'>1158</span> </span><span class="WHIT">			   </span><span class="NAME">this.pubkeyAlgName</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"rsa"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1159</span> </span><span class="WHIT">		    </span><span class="NAME">this.hSign</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.prvKey.signWithMessageHash</span><span class="PUNC">(</span><span class="NAME">this.sHashHex</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1160</span> </span><span class="WHIT">								 </span><span class="NAME">this.mdAlgName</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1161</span> </span><span class="WHIT">		</span><span class="COMM">// ECDSA</span><span class="WHIT">
<span class='line'>1162</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.prvKey</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">KJUR.crypto.ECDSA</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1163</span> </span><span class="WHIT">		    </span><span class="NAME">this.hSign</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.prvKey.signWithMessageHash</span><span class="PUNC">(</span><span class="NAME">this.sHashHex</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1164</span> </span><span class="WHIT">		</span><span class="COMM">// DSA</span><span class="WHIT">
<span class='line'>1165</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.prvKey</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">KJUR.crypto.DSA</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1166</span> </span><span class="WHIT">		    </span><span class="NAME">this.hSign</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.prvKey.signWithMessageHash</span><span class="PUNC">(</span><span class="NAME">this.sHashHex</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1167</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1168</span> </span><span class="WHIT">		    </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"Signature: unsupported private key alg: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this.pubkeyAlgName</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1169</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1170</span> </span><span class="WHIT">		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.hSign</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1171</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1172</span> </span><span class="WHIT">	    </span><span class="NAME">this.signString</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">str</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1173</span> </span><span class="WHIT">		</span><span class="NAME">this.updateString</span><span class="PUNC">(</span><span class="NAME">str</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1174</span> </span><span class="WHIT">		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.sign</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1175</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1176</span> </span><span class="WHIT">	    </span><span class="NAME">this.signHex</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">hex</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1177</span> </span><span class="WHIT">		</span><span class="NAME">this.updateHex</span><span class="PUNC">(</span><span class="NAME">hex</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1178</span> </span><span class="WHIT">		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.sign</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1179</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1180</span> </span><span class="WHIT">	    </span><span class="NAME">this.verify</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">hSigVal</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1181</span> </span><span class="WHIT">	        </span><span class="NAME">this.sHashHex</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.md.digest</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1182</span> </span><span class="WHIT">		</span><span class="COMM">// hex parameter EC public key</span><span class="WHIT">
<span class='line'>1183</span> </span><span class="WHIT">		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.pubKey</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT">
<span class='line'>1184</span> </span><span class="WHIT">		    </span><span class="NAME">this.ecpubhex</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT">
<span class='line'>1185</span> </span><span class="WHIT">		    </span><span class="NAME">this.eccurvename</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT">
<span class='line'>1186</span> </span><span class="WHIT">		    </span><span class="NAME">KJUR.crypto.ECDSA</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1187</span> </span><span class="WHIT">		    </span><span class="NAME">this.pubKey</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">KJUR.crypto.ECDSA</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="NAME">curve</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">this.eccurvename</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1188</span> </span><span class="WHIT">							 </span><span class="NAME">pub</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">this.ecpubhex</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1189</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1190</span> 
<span class='line'>1191</span> </span><span class="WHIT">		</span><span class="COMM">// RSAPSS</span><span class="WHIT">
<span class='line'>1192</span> </span><span class="WHIT">		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.pubKey</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">RSAKey</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT">
<span class='line'>1193</span> </span><span class="WHIT">		    </span><span class="NAME">this.pubkeyAlgName</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"rsaandmgf1"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1194</span> </span><span class="WHIT">		    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.pubKey.verifyWithMessageHashPSS</span><span class="PUNC">(</span><span class="NAME">this.sHashHex</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">hSigVal</span><span class="PUNC">,</span><span class="WHIT"> 
<span class='line'>1195</span> 								</span><span class="NAME">this.mdAlgName</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1196</span> </span><span class="WHIT">								</span><span class="NAME">this.pssSaltLen</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1197</span> </span><span class="WHIT">		</span><span class="COMM">// RSA</span><span class="WHIT">
<span class='line'>1198</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.pubKey</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">RSAKey</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT">
<span class='line'>1199</span> </span><span class="WHIT">			   </span><span class="NAME">this.pubkeyAlgName</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"rsa"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1200</span> </span><span class="WHIT">		    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.pubKey.verifyWithMessageHash</span><span class="PUNC">(</span><span class="NAME">this.sHashHex</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">hSigVal</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1201</span> </span><span class="WHIT">                </span><span class="COMM">// ECDSA</span><span class="WHIT">
<span class='line'>1202</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">KJUR.crypto.ECDSA</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT">
<span class='line'>1203</span> </span><span class="WHIT">			   </span><span class="NAME">this.pubKey</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">KJUR.crypto.ECDSA</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1204</span> </span><span class="WHIT">		    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.pubKey.verifyWithMessageHash</span><span class="PUNC">(</span><span class="NAME">this.sHashHex</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">hSigVal</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1205</span> </span><span class="WHIT">                </span><span class="COMM">// DSA</span><span class="WHIT">
<span class='line'>1206</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">KJUR.crypto.DSA</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT">
<span class='line'>1207</span> </span><span class="WHIT">			   </span><span class="NAME">this.pubKey</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">KJUR.crypto.DSA</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1208</span> </span><span class="WHIT">		    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.pubKey.verifyWithMessageHash</span><span class="PUNC">(</span><span class="NAME">this.sHashHex</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">hSigVal</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1209</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1210</span> </span><span class="WHIT">		    </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"Signature: unsupported public key alg: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this.pubkeyAlgName</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1211</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1212</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1213</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1214</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1215</span> 
<span class='line'>1216</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>1217</span>      * Initialize this object for signing or verifying depends on key
<span class='line'>1218</span>      * @name init
<span class='line'>1219</span>      * @memberOf KJUR.crypto.Signature#
<span class='line'>1220</span>      * @function
<span class='line'>1221</span>      * @param {Object} key specifying public or private key as plain/encrypted PKCS#5/8 PEM file, certificate PEM or {@link RSAKey}, {@link KJUR.crypto.DSA} or {@link KJUR.crypto.ECDSA} object
<span class='line'>1222</span>      * @param {String} pass (OPTION) passcode for encrypted private key
<span class='line'>1223</span>      * @since crypto 1.1.3
<span class='line'>1224</span>      * @description
<span class='line'>1225</span>      * This method is very useful initialize method for Signature class since
<span class='line'>1226</span>      * you just specify key then this method will automatically initialize it
<span class='line'>1227</span>      * using {@link KEYUTIL.getKey} method.
<span class='line'>1228</span>      * As for 'key',  following argument type are supported:
<span class='line'>1229</span>      * &lt;h5>signing&lt;/h5>
<span class='line'>1230</span>      * &lt;ul>
<span class='line'>1231</span>      * &lt;li>PEM formatted PKCS#8 encrypted RSA/ECDSA private key concluding "BEGIN ENCRYPTED PRIVATE KEY"&lt;/li>
<span class='line'>1232</span>      * &lt;li>PEM formatted PKCS#5 encrypted RSA/DSA private key concluding "BEGIN RSA/DSA PRIVATE KEY" and ",ENCRYPTED"&lt;/li>
<span class='line'>1233</span>      * &lt;li>PEM formatted PKCS#8 plain RSA/ECDSA private key concluding "BEGIN PRIVATE KEY"&lt;/li>
<span class='line'>1234</span>      * &lt;li>PEM formatted PKCS#5 plain RSA/DSA private key concluding "BEGIN RSA/DSA PRIVATE KEY" without ",ENCRYPTED"&lt;/li>
<span class='line'>1235</span>      * &lt;li>RSAKey object of private key&lt;/li>
<span class='line'>1236</span>      * &lt;li>KJUR.crypto.ECDSA object of private key&lt;/li>
<span class='line'>1237</span>      * &lt;li>KJUR.crypto.DSA object of private key&lt;/li>
<span class='line'>1238</span>      * &lt;/ul>
<span class='line'>1239</span>      * &lt;h5>verification&lt;/h5>
<span class='line'>1240</span>      * &lt;ul>
<span class='line'>1241</span>      * &lt;li>PEM formatted PKCS#8 RSA/EC/DSA public key concluding "BEGIN PUBLIC KEY"&lt;/li>
<span class='line'>1242</span>      * &lt;li>PEM formatted X.509 certificate with RSA/EC/DSA public key concluding
<span class='line'>1243</span>      *     "BEGIN CERTIFICATE", "BEGIN X509 CERTIFICATE" or "BEGIN TRUSTED CERTIFICATE".&lt;/li>
<span class='line'>1244</span>      * &lt;li>RSAKey object of public key&lt;/li>
<span class='line'>1245</span>      * &lt;li>KJUR.crypto.ECDSA object of public key&lt;/li>
<span class='line'>1246</span>      * &lt;li>KJUR.crypto.DSA object of public key&lt;/li>
<span class='line'>1247</span>      * &lt;/ul>
<span class='line'>1248</span>      * @example
<span class='line'>1249</span>      * sig.init(sCertPEM)
<span class='line'>1250</span>      */</span><span class="WHIT">
<span class='line'>1251</span> </span><span class="WHIT">    </span><span class="NAME">this.init</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">pass</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1252</span> </span><span class="WHIT">	</span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"init(key, pass) not supported for this alg:prov="</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
<span class='line'>1253</span> </span><span class="WHIT">	      </span><span class="NAME">this.algProvName</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1254</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1255</span> 
<span class='line'>1256</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>1257</span>      * Updates the data to be signed or verified by a string
<span class='line'>1258</span>      * @name updateString
<span class='line'>1259</span>      * @memberOf KJUR.crypto.Signature#
<span class='line'>1260</span>      * @function
<span class='line'>1261</span>      * @param {String} str string to use for the update
<span class='line'>1262</span>      * @description
<span class='line'>1263</span>      * @example
<span class='line'>1264</span>      * sig.updateString('aaa')
<span class='line'>1265</span>      */</span><span class="WHIT">
<span class='line'>1266</span> </span><span class="WHIT">    </span><span class="NAME">this.updateString</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">str</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1267</span> </span><span class="WHIT">	</span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"updateString(str) not supported for this alg:prov="</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this.algProvName</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1268</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1269</span> 
<span class='line'>1270</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>1271</span>      * Updates the data to be signed or verified by a hexadecimal string
<span class='line'>1272</span>      * @name updateHex
<span class='line'>1273</span>      * @memberOf KJUR.crypto.Signature#
<span class='line'>1274</span>      * @function
<span class='line'>1275</span>      * @param {String} hex hexadecimal string to use for the update
<span class='line'>1276</span>      * @description
<span class='line'>1277</span>      * @example
<span class='line'>1278</span>      * sig.updateHex('1f2f3f')
<span class='line'>1279</span>      */</span><span class="WHIT">
<span class='line'>1280</span> </span><span class="WHIT">    </span><span class="NAME">this.updateHex</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">hex</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1281</span> </span><span class="WHIT">	</span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"updateHex(hex) not supported for this alg:prov="</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this.algProvName</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1282</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1283</span> 
<span class='line'>1284</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>1285</span>      * Returns the signature bytes of all data updates as a hexadecimal string
<span class='line'>1286</span>      * @name sign
<span class='line'>1287</span>      * @memberOf KJUR.crypto.Signature#
<span class='line'>1288</span>      * @function
<span class='line'>1289</span>      * @return the signature bytes as a hexadecimal string
<span class='line'>1290</span>      * @description
<span class='line'>1291</span>      * @example
<span class='line'>1292</span>      * var hSigValue = sig.sign()
<span class='line'>1293</span>      */</span><span class="WHIT">
<span class='line'>1294</span> </span><span class="WHIT">    </span><span class="NAME">this.sign</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1295</span> </span><span class="WHIT">	</span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"sign() not supported for this alg:prov="</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this.algProvName</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1296</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1297</span> 
<span class='line'>1298</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>1299</span>      * performs final update on the sign using string, then returns the signature bytes of all data updates as a hexadecimal string
<span class='line'>1300</span>      * @name signString
<span class='line'>1301</span>      * @memberOf KJUR.crypto.Signature#
<span class='line'>1302</span>      * @function
<span class='line'>1303</span>      * @param {String} str string to final update
<span class='line'>1304</span>      * @return the signature bytes of a hexadecimal string
<span class='line'>1305</span>      * @description
<span class='line'>1306</span>      * @example
<span class='line'>1307</span>      * var hSigValue = sig.signString('aaa')
<span class='line'>1308</span>      */</span><span class="WHIT">
<span class='line'>1309</span> </span><span class="WHIT">    </span><span class="NAME">this.signString</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">str</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1310</span> </span><span class="WHIT">	</span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"digestString(str) not supported for this alg:prov="</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this.algProvName</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1311</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1312</span> 
<span class='line'>1313</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>1314</span>      * performs final update on the sign using hexadecimal string, then returns the signature bytes of all data updates as a hexadecimal string
<span class='line'>1315</span>      * @name signHex
<span class='line'>1316</span>      * @memberOf KJUR.crypto.Signature#
<span class='line'>1317</span>      * @function
<span class='line'>1318</span>      * @param {String} hex hexadecimal string to final update
<span class='line'>1319</span>      * @return the signature bytes of a hexadecimal string
<span class='line'>1320</span>      * @description
<span class='line'>1321</span>      * @example
<span class='line'>1322</span>      * var hSigValue = sig.signHex('1fdc33')
<span class='line'>1323</span>      */</span><span class="WHIT">
<span class='line'>1324</span> </span><span class="WHIT">    </span><span class="NAME">this.signHex</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">hex</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1325</span> </span><span class="WHIT">	</span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"digestHex(hex) not supported for this alg:prov="</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this.algProvName</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1326</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1327</span> 
<span class='line'>1328</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>1329</span>      * verifies the passed-in signature.
<span class='line'>1330</span>      * @name verify
<span class='line'>1331</span>      * @memberOf KJUR.crypto.Signature#
<span class='line'>1332</span>      * @function
<span class='line'>1333</span>      * @param {String} str string to final update
<span class='line'>1334</span>      * @return {Boolean} true if the signature was verified, otherwise false
<span class='line'>1335</span>      * @description
<span class='line'>1336</span>      * @example
<span class='line'>1337</span>      * var isValid = sig.verify('1fbcefdca4823a7(snip)')
<span class='line'>1338</span>      */</span><span class="WHIT">
<span class='line'>1339</span> </span><span class="WHIT">    </span><span class="NAME">this.verify</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">hSigVal</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1340</span> </span><span class="WHIT">	</span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"verify(hSigVal) not supported for this alg:prov="</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this.algProvName</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1341</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1342</span> 
<span class='line'>1343</span> </span><span class="WHIT">    </span><span class="NAME">this.initParams</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">params</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1344</span> 
<span class='line'>1345</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">params</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1346</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">params.alg</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1347</span> </span><span class="WHIT">	    </span><span class="NAME">this.algName</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">params.alg</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1348</span> </span><span class="WHIT">	    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">params.prov</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1349</span> </span><span class="WHIT">		</span><span class="NAME">this.provName</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">KJUR.crypto.Util.DEFAULTPROVIDER</span><span class="PUNC">[</span><span class="NAME">this.algName</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1350</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1351</span> </span><span class="WHIT">		</span><span class="NAME">this.provName</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">params.prov</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1352</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1353</span> </span><span class="WHIT">	    </span><span class="NAME">this.algProvName</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.algName</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">":"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this.provName</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1354</span> </span><span class="WHIT">	    </span><span class="NAME">this.setAlgAndProvider</span><span class="PUNC">(</span><span class="NAME">this.algName</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">this.provName</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1355</span> </span><span class="WHIT">	    </span><span class="NAME">this._setAlgNames</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1356</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1357</span> 
<span class='line'>1358</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">params</span><span class="PUNC">[</span><span class="STRN">'psssaltlen'</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">this.pssSaltLen</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">params</span><span class="PUNC">[</span><span class="STRN">'psssaltlen'</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1359</span> 
<span class='line'>1360</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">params.prvkeypem</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1361</span> </span><span class="WHIT">	    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">params.prvkeypas</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1362</span> </span><span class="WHIT">		</span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"both prvkeypem and prvkeypas parameters not supported"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1363</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1364</span> </span><span class="WHIT">		</span><span class="KEYW">try</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1365</span> </span><span class="WHIT">		    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">prvKey</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">KEYUTIL.getKey</span><span class="PUNC">(</span><span class="NAME">params.prvkeypem</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1366</span> </span><span class="WHIT">		    </span><span class="NAME">this.init</span><span class="PUNC">(</span><span class="NAME">prvKey</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1367</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">catch</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">ex</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1368</span> </span><span class="WHIT">		    </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"fatal error to load pem private key: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">ex</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1369</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1370</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1371</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1372</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1373</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1374</span> 
<span class='line'>1375</span> </span><span class="COMM">// ====== Cipher class ============================================================</span><span class="WHIT">
<span class='line'>1376</span> </span><span class="COMM">/**
<span class='line'>1377</span>  * Cipher class to encrypt and decrypt data&lt;br/>
<span class='line'>1378</span>  * @name KJUR.crypto.Cipher
<span class='line'>1379</span>  * @class Cipher class to encrypt and decrypt data&lt;br/>
<span class='line'>1380</span>  * @param {Array} params parameters for constructor
<span class='line'>1381</span>  * @since jsrsasign 6.2.0 crypto 1.1.10
<span class='line'>1382</span>  * @description
<span class='line'>1383</span>  * Here is supported canonicalized cipher algorithm names and its standard names:
<span class='line'>1384</span>  * &lt;ul>
<span class='line'>1385</span>  * &lt;li>aes256-CBC&lt;/li>
<span class='line'>1386</span>  * &lt;li>aes128-CBC&lt;/li>
<span class='line'>1387</span>  * &lt;li>des-EDE3-CBC&lt;/li>
<span class='line'>1388</span>  * &lt;/ul>
<span class='line'>1389</span>  * NOTE: From jsrsasign 11.0.0, RSA and RSAOAEP encryption/decryption support is removed
<span class='line'>1390</span>  * because of Marvin attack vulnerability.
<span class='line'>1391</span>  */</span><span class="WHIT">
<span class='line'>1392</span> </span><span class="NAME">KJUR.crypto.Cipher</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">params</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1393</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1394</span> 
<span class='line'>1395</span> </span><span class="COMM">/**
<span class='line'>1396</span>  * encrypt raw string by specified key and algorithm&lt;br/>
<span class='line'>1397</span>  * @name encrypt
<span class='line'>1398</span>  * @memberOf KJUR.crypto.Cipher
<span class='line'>1399</span>  * @function
<span class='line'>1400</span>  * @param {string} s input string to encrypt
<span class='line'>1401</span>  * @param {string} hexadecimal string of symmetric cipher key
<span class='line'>1402</span>  * @param {string} algName short/long algorithm name for encryption/decryption (OPTION)
<span class='line'>1403</span>  * @param {object} param parameters for synchronous cipher such as initial vector (OPTION)
<span class='line'>1404</span>  * @return {string} hexadecimal encrypted string
<span class='line'>1405</span>  * @since jsrsasign 6.2.0 crypto 1.1.10
<span class='line'>1406</span>  *
<span class='line'>1407</span>  * @description
<span class='line'>1408</span>  * This static method encrypts raw string with specified key and algorithm.
<span class='line'>1409</span>  * &lt;br/>
<span class='line'>1410</span>  * NOTE: From jsrsasign 10.9.0, asymmetric cipher ({des-EDE3,aes{128,256}}-CBC) is also supported.
<span class='line'>1411</span>  * NOTE2: From jsrsasign 11.0.0, RSA and RSAOAEP encryption/decryption support is removed
<span class='line'>1412</span>  * because of Marvin attack vulnerability.
<span class='line'>1413</span>  *
<span class='line'>1414</span>  * @example 
<span class='line'>1415</span>  * KJUR.crypto.Cipher.encrypt("12abcd...", "5a7d...", "aes256-CBC", { iv: "1b3c..." }) 
<span class='line'>1416</span>  * KJUR.crypto.Cipher.encrypt("12abcd...", "5a7d...", any, { encalg: "aes128-CBC", iv: "1b3c..." }) 
<span class='line'>1417</span>  * KJUR.crypto.Cipher.encrypt("12abcd...", any, any, { encalg: "des-EDE3-CBC", iv: "1b3c...", key: "3d41..." }) 
<span class='line'>1418</span>  * KJUR.crypto.Cipher.encrypt(any, any, any, { encalg: "des-EDE3-CBC", iv: "1b3c...", key: "3d41...", enc: "12abcd..." }) 
<span class='line'>1419</span>  */</span><span class="WHIT">
<span class='line'>1420</span> </span><span class="NAME">KJUR.crypto.Cipher.encrypt</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">keyObj</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">algName</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">param</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1421</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">aryval</span><span class="PUNC">(</span><span class="NAME">param</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"enclag"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">algName</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">param.encalg</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1422</span> 
<span class='line'>1423</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">algName</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"string"</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">algName.substr</span><span class="PUNC">(</span><span class="PUNC">-</span><span class="NUMB">4</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"-CBC"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1424</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">hKey</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">keyObj</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1425</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">hPlain</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">s</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1426</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">aryval</span><span class="PUNC">(</span><span class="NAME">param</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"key"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">hKey</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">param.key</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1427</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">aryval</span><span class="PUNC">(</span><span class="NAME">param</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"enc"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">hEnc</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">param.enc</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1428</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">wKey</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">CryptoJS.enc.Hex.parse</span><span class="PUNC">(</span><span class="NAME">hKey</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1429</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">wPlain</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">CryptoJS.enc.Hex.parse</span><span class="PUNC">(</span><span class="NAME">hPlain</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1430</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">wIV</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">CryptoJS.enc.Hex.parse</span><span class="PUNC">(</span><span class="NAME">param.iv</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1431</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">wEnc</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1432</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">algName</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"des-EDE3-CBC"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1433</span> </span><span class="WHIT">	    </span><span class="NAME">wEnc</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">CryptoJS.TripleDES.encrypt</span><span class="PUNC">(</span><span class="NAME">wPlain</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">wKey</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">iv</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">wIV</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1434</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">algName</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"aes128-CBC"</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">algName</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"aes256-CBC"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1435</span> </span><span class="WHIT">	    </span><span class="NAME">wEnc</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">CryptoJS.AES.encrypt</span><span class="PUNC">(</span><span class="NAME">wPlain</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">wKey</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">iv</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">wIV</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1436</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1437</span> </span><span class="WHIT">	    </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">(</span><span class="STRN">"unsupported algorithm: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">algName</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1438</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1439</span> </span><span class="WHIT">	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">wEnc</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1440</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1441</span> </span><span class="WHIT">	</span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">(</span><span class="STRN">"Cipher.encrypt: unsupported key or algorithm"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1442</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1443</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1444</span> 
<span class='line'>1445</span> </span><span class="COMM">/**
<span class='line'>1446</span>  * decrypt encrypted hexadecimal string with specified key and algorithm&lt;br/>
<span class='line'>1447</span>  * @name decrypt
<span class='line'>1448</span>  * @memberOf KJUR.crypto.Cipher
<span class='line'>1449</span>  * @function
<span class='line'>1450</span>  * @param {string} hex hexadecimal string of encrypted message
<span class='line'>1451</span>  * @param {object} hexadecimal string of symmetric cipher key
<span class='line'>1452</span>  * @param {string} algName short/long algorithm name for encryption/decryption (OPTION)
<span class='line'>1453</span>  * @param {object} param parameters for synchronous cipher such as initial vector (OPTION)
<span class='line'>1454</span>  * @return {string} decrypted raw string
<span class='line'>1455</span>  * @since jsrsasign 6.2.0 crypto 1.1.10
<span class='line'>1456</span>  *
<span class='line'>1457</span>  * @description
<span class='line'>1458</span>  * This static method decrypts encrypted hexadecimal string with specified key and algorithm.
<span class='line'>1459</span>  * &lt;br/>
<span class='line'>1460</span>  * NOTE: From jsrsasign 10.9.0, asymmetric cipher ({des-EDE3,aes{128,256}}-CBCis also supported.
<span class='line'>1461</span>  * NOTE2: From jsrsasign 11.0.0, RSA and RSAOAEP encryption/decryption support is removed
<span class='line'>1462</span>  * because of Marvin attack vulnerability.
<span class='line'>1463</span>  *
<span class='line'>1464</span>  * @example 
<span class='line'>1465</span>  * KJUR.crypto.Cipher.decrypt("12abcd...", "5a7d...", "aes256-CBC", { iv: "1b3c..." }) 
<span class='line'>1466</span>  * KJUR.crypto.Cipher.decrypt("12abcd...", "5a7d...", any, { encalg: "aes128-CBC", iv: "1b3c..." }) 
<span class='line'>1467</span>  * KJUR.crypto.Cipher.decrypt("12abcd...", any, any, { encalg: "des-EDE3-CBC", iv: "1b3c...", key: "3d41..." }) 
<span class='line'>1468</span>  * KJUR.crypto.Cipher.decrypt(any, any, any, { encalg: "des-EDE3-CBC", iv: "1b3c...", key: "3d41...", enc: "12abcd..." }) 
<span class='line'>1469</span>  */</span><span class="WHIT">
<span class='line'>1470</span> </span><span class="NAME">KJUR.crypto.Cipher.decrypt</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">hex</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">keyObj</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">algName</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">param</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1471</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">aryval</span><span class="PUNC">(</span><span class="NAME">param</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"enclag"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">algName</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">param.encalg</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1472</span> 
<span class='line'>1473</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">algName</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"string"</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">algName.substr</span><span class="PUNC">(</span><span class="PUNC">-</span><span class="NUMB">4</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"-CBC"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1474</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">hKey</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">keyObj</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1475</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">hEnc</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">hex</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1476</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">aryval</span><span class="PUNC">(</span><span class="NAME">param</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"key"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">hKey</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">param.key</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1477</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">aryval</span><span class="PUNC">(</span><span class="NAME">param</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"enc"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">hEnc</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">param.enc</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1478</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">wKey</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">CryptoJS.enc.Hex.parse</span><span class="PUNC">(</span><span class="NAME">hKey</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1479</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">wEnc</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">CryptoJS.enc.Hex.parse</span><span class="PUNC">(</span><span class="NAME">hEnc</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1480</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">wIV</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">CryptoJS.enc.Hex.parse</span><span class="PUNC">(</span><span class="NAME">param.iv</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1481</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">wDec</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1482</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">algName</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"des-EDE3-CBC"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1483</span> </span><span class="WHIT">	    </span><span class="NAME">wDec</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">CryptoJS.TripleDES.decrypt</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">ciphertext</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">wEnc</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">wKey</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">iv</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">wIV</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1484</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">algName</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"aes128-CBC"</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">algName</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"aes256-CBC"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1485</span> </span><span class="WHIT">	    </span><span class="NAME">wDec</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">CryptoJS.AES.decrypt</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">ciphertext</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">wEnc</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">wKey</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">iv</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">wIV</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1486</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1487</span> </span><span class="WHIT">	    </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">(</span><span class="STRN">"unsupported algorithm: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">algName</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1488</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1489</span> </span><span class="WHIT">	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">CryptoJS.enc.Hex.stringify</span><span class="PUNC">(</span><span class="NAME">wDec</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1490</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1491</span> </span><span class="WHIT">	</span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">(</span><span class="STRN">"Cipher.decrypt: unsupported key or algorithm"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1492</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1493</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1494</span> 
<span class='line'>1495</span> </span><span class="COMM">/*
<span class='line'>1496</span>  * get canonicalized encrypt/decrypt algorithm name by key and short/long algorithm name&lt;br/>
<span class='line'>1497</span>  * @name getAlgByKeyAndName
<span class='line'>1498</span>  * @memberOf KJUR.crypto.Cipher
<span class='line'>1499</span>  * @function
<span class='line'>1500</span>  * @param {Object} keyObj RSAKey object or hexadecimal string of symmetric cipher key
<span class='line'>1501</span>  * @param {String} algName short/long algorithm name for encryption/decryption
<span class='line'>1502</span>  * @return {String} canonicalized algorithm name for encryption/decryption
<span class='line'>1503</span>  * @since jsrsasign 6.2.0 crypto 1.1.10
<span class='line'>1504</span>  * @description
<span class='line'>1505</span>  * Here is supported canonicalized cipher algorithm names and its standard names:
<span class='line'>1506</span>  * &lt;ul>
<span class='line'>1507</span>  * &lt;li>RSA - RSA/ECB/PKCS1Padding (default for RSAKey)&lt;/li>
<span class='line'>1508</span>  * &lt;li>RSAOAEP - RSA/ECB/OAEPWithSHA-1AndMGF1Padding&lt;/li>
<span class='line'>1509</span>  * &lt;li>RSAOAEP224 - RSA/ECB/OAEPWithSHA-224AndMGF1Padding(*)&lt;/li>
<span class='line'>1510</span>  * &lt;li>RSAOAEP256 - RSA/ECB/OAEPWithSHA-256AndMGF1Padding&lt;/li>
<span class='line'>1511</span>  * &lt;li>RSAOAEP384 - RSA/ECB/OAEPWithSHA-384AndMGF1Padding(*)&lt;/li>
<span class='line'>1512</span>  * &lt;li>RSAOAEP512 - RSA/ECB/OAEPWithSHA-512AndMGF1Padding(*)&lt;/li>
<span class='line'>1513</span>  * &lt;/ul>
<span class='line'>1514</span>  * NOTE: (*) is not supported in Java JCE.
<span class='line'>1515</span>  * @example 
<span class='line'>1516</span>  * KJUR.crypto.Cipher.getAlgByKeyAndName(objRSAKey) &rarr; "RSA"
<span class='line'>1517</span>  * KJUR.crypto.Cipher.getAlgByKeyAndName(objRSAKey, "RSAOAEP") &rarr; "RSAOAEP"
<span class='line'>1518</span>  */</span><span class="WHIT">
<span class='line'>1519</span> </span><span class="COMM">/*
<span class='line'>1520</span> KJUR.crypto.Cipher.getAlgByKeyAndName = function(keyObj, algName) {
<span class='line'>1521</span>     if (keyObj instanceof RSAKey) {
<span class='line'>1522</span> 	if (":RSA:RSAOAEP:RSAOAEP224:RSAOAEP256:RSAOAEP384:RSAOAEP512:".indexOf(algName) != -1)
<span class='line'>1523</span> 	    return algName;
<span class='line'>1524</span> 	if (algName === null || algName === undefined) return "RSA";
<span class='line'>1525</span> 	throw "getAlgByKeyAndName: not supported algorithm name for RSAKey: " + algName;
<span class='line'>1526</span>     }
<span class='line'>1527</span>     throw "getAlgByKeyAndName: not supported algorithm name: " + algName;
<span class='line'>1528</span> }
<span class='line'>1529</span>  */</span><span class="WHIT">
<span class='line'>1530</span> 
<span class='line'>1531</span> </span><span class="COMM">// ====== Other Utility class =====================================================</span><span class="WHIT">
<span class='line'>1532</span> 
<span class='line'>1533</span> </span><span class="COMM">/**
<span class='line'>1534</span>  * static object for cryptographic function utilities
<span class='line'>1535</span>  * @name KJUR.crypto.OID
<span class='line'>1536</span>  * @class static object for cryptography related OIDs
<span class='line'>1537</span>  * @property {Array} oidhex2name key value of hexadecimal OID and its name
<span class='line'>1538</span>  *           (ex. '2a8648ce3d030107' and 'secp256r1')
<span class='line'>1539</span>  * @since crypto 1.1.3
<span class='line'>1540</span>  * @description
<span class='line'>1541</span>  */</span><span class="WHIT">
<span class='line'>1542</span> </span><span class="NAME">KJUR.crypto.OID</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1543</span> </span><span class="WHIT">    </span><span class="NAME">this.oidhex2name</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1544</span> </span><span class="WHIT">	</span><span class="STRN">'2a864886f70d010101'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'rsaEncryption'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1545</span> </span><span class="WHIT">	</span><span class="STRN">'2a8648ce3d0201'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'ecPublicKey'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1546</span> </span><span class="WHIT">	</span><span class="STRN">'2a8648ce380401'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'dsa'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1547</span> </span><span class="WHIT">	</span><span class="STRN">'2a8648ce3d030107'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'secp256r1'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1548</span> </span><span class="WHIT">	</span><span class="STRN">'2b8104001f'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'secp192k1'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1549</span> </span><span class="WHIT">	</span><span class="STRN">'2b81040021'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'secp224r1'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1550</span> </span><span class="WHIT">	</span><span class="STRN">'2b8104000a'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'secp256k1'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1551</span> </span><span class="WHIT">	</span><span class="STRN">'2b81040022'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'secp384r1'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1552</span> </span><span class="WHIT">	</span><span class="STRN">'2b81040023'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'secp521r1'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1553</span> </span><span class="WHIT">	</span><span class="STRN">'2a8648ce380403'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'SHA1withDSA'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="COMM">// 1.2.840.10040.4.3</span><span class="WHIT">
<span class='line'>1554</span> </span><span class="WHIT">	</span><span class="STRN">'608648016503040301'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'SHA224withDSA'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="COMM">// 2.16.840.1.101.3.4.3.1</span><span class="WHIT">
<span class='line'>1555</span> </span><span class="WHIT">	</span><span class="STRN">'608648016503040302'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'SHA256withDSA'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="COMM">// 2.16.840.1.101.3.4.3.2</span><span class="WHIT">
<span class='line'>1556</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1557</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1558</span> </span></pre></body></html>